Re #752 Add demo for TabControl in Credits menu

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5278 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
pouillot 2013-03-08 19:45:34 +00:00
parent c42966542e
commit 2a62c4f007
5 changed files with 89 additions and 196 deletions

View File

@ -198,15 +198,15 @@
<Image Height="7" Name="TabButtonLowerRightNormal" Width="7" XPos="62" YPos="99" />
<Image Height="7" Name="TabButtonLowerRight2Normal" Width="7" XPos="187" YPos="195" />
<Image Height="6" Name="TabButtonMiddleNormal" Width="6" XPos="52" YPos="89" />
<Image Height="6" Name="TabButtonLeftSelected" Width="7" XPos="41" YPos="89" />
<Image Height="6" Name="TabButtonRightSelected" Width="7" XPos="62" YPos="89" />
<Image Height="7" Name="TabButtonUpperSelected" Width="6" XPos="52" YPos="78" />
<Image Height="6" Name="TabButtonLowerSelected" Width="6" XPos="52" YPos="89" />
<Image Height="7" Name="TabButtonUpperLeftSelected" Width="7" XPos="41" YPos="78" />
<Image Height="7" Name="TabButtonUpperRightSelected" Width="7" XPos="62" YPos="78" />
<Image Height="7" Name="TabButtonLowerLeftSelected" Width="7" XPos="41" YPos="99" />
<Image Height="7" Name="TabButtonLowerRightSelected" Width="7" XPos="62" YPos="99" />
<Image Height="6" Name="TabButtonMiddleSelected" Width="6" XPos="52" YPos="89" />
<Image Height="6" Name="TabButtonLeftSelected" Width="7" XPos="62" YPos="172" />
<Image Height="6" Name="TabButtonRightSelected" Width="7" XPos="83" YPos="172" />
<Image Height="7" Name="TabButtonUpperSelected" Width="6" XPos="73" YPos="161" />
<Image Height="6" Name="TabButtonLowerSelected" Width="6" XPos="73" YPos="172" />
<Image Height="7" Name="TabButtonUpperLeftSelected" Width="7" XPos="62" YPos="161" />
<Image Height="7" Name="TabButtonUpperRightSelected" Width="7" XPos="83" YPos="161" />
<Image Height="7" Name="TabButtonLowerLeftSelected" Width="7" XPos="62" YPos="182" />
<Image Height="7" Name="TabButtonLowerRightSelected" Width="7" XPos="83" YPos="182" />
<Image Height="6" Name="TabButtonMiddleSelected" Width="6" XPos="73" YPos="172" />
<Image Height="4" Name="TooltipTopLeft" Width="4" XPos="43" YPos="313" />
<Image Height="4" Name="TooltipTopRight" Width="5" XPos="67" YPos="313" />
<Image Height="5" Name="TooltipBottomLeft" Width="4" XPos="43" YPos="337" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -9,9 +9,9 @@
<Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.3,0},{0.25,0}}" />
<Property Name="Image" Value="set:Logo image:everything" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="Tooltip" Value="What a nice logo !" />
<Property Name="FrameEnabled" Value="False" />
<Property Name="BackgroundEnabled" Value="False" />
<Property Name="Tooltip" Value="What a nice logo !" />
</Window>
<Window Name="MenuCredits/TxtTitle" Type="CEGUIDemo/PageTitle">
<Property Name="UnifiedAreaRect" Value="{{0.22,0},{0.1,0},{0.92,0},{0.2,0}}" />
@ -20,30 +20,6 @@
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
<Property Name="FrameEnabled" Value="False" />
<AutoWindow NameSuffix="__auto_hscrollbar__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
<AutoWindow NameSuffix="__auto_incbtn__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_decbtn__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_thumb__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
</AutoWindow>
</AutoWindow>
<AutoWindow NameSuffix="__auto_vscrollbar__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
<AutoWindow NameSuffix="__auto_incbtn__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_decbtn__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_thumb__">
<Property Name="Tooltip" Value="Yeah, this is the title of the menu !" />
</AutoWindow>
</AutoWindow>
</Window>
<Window Name="MenuCredits/TxtFrameRate" Type="CEGUIDemo/StaticText">
<Property Name="UnifiedAreaRect" Value="{{0.95,0},{0.01,0},{0.99,0},{0.04,0}}" />
@ -56,84 +32,6 @@
<Property Name="HorzFormatting" Value="RightAligned" />
<Property Name="VertFormatting" Value="TopAligned" />
<Property Name="BackgroundEnabled" Value="False" />
<AutoWindow NameSuffix="__auto_hscrollbar__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
<AutoWindow NameSuffix="__auto_incbtn__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_decbtn__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_thumb__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
</AutoWindow>
</AutoWindow>
<AutoWindow NameSuffix="__auto_vscrollbar__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
<AutoWindow NameSuffix="__auto_incbtn__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_decbtn__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_thumb__">
<Property Name="Tooltip" Value="Frame rate (F/s)" />
</AutoWindow>
</AutoWindow>
</Window>
<Window Name="MenuCredits/MclTable" Type="CEGUIDemo/MultiColumnList">
<Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.3,0},{0.9,0},{0.8,0}}" />
<Property Name="Font" Value="TextSmall" />
<Property Name="Tooltip" Value="Details about contributions" />
<Property Name="ColumnsMovable" Value="False" />
<Property Name="ColumnsSizable" Value="False" />
<Property Name="SortSettingEnabled" Value="False" />
<AutoWindow NameSuffix="__auto_listheader__">
<Property Name="Tooltip" Value="Details about contributions" />
<Property Name="ColumnsMovable" Value="False" />
<Property Name="ColumnsSizable" Value="False" />
<Property Name="SortSettingEnabled" Value="False" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_hscrollbar__">
<Property Name="Tooltip" Value="Details about contributions" />
<AutoWindow NameSuffix="__auto_incbtn__">
<Property Name="Tooltip" Value="Details about contributions" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_decbtn__">
<Property Name="Tooltip" Value="Details about contributions" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_thumb__">
<Property Name="Tooltip" Value="Details about contributions" />
</AutoWindow>
</AutoWindow>
<AutoWindow NameSuffix="__auto_vscrollbar__">
<Property Name="Tooltip" Value="Details about contributions" />
<AutoWindow NameSuffix="__auto_incbtn__">
<Property Name="Tooltip" Value="Details about contributions" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_decbtn__">
<Property Name="Tooltip" Value="Details about contributions" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_thumb__">
<Property Name="Tooltip" Value="Details about contributions" />
</AutoWindow>
</AutoWindow>
</Window>
<Window Name="MenuCredits/BtnPrevPage" Type="CEGUIDemo/ImageButton">
<Property Name="UnifiedAreaRect" Value="{{0.9,0},{0.7,0},{0.97,0},{0.8,0}}" />
<Property Name="HoverImage" Value="set:CEGUIDemo image:ArrowUpHighlight" />
<Property Name="NormalImage" Value="set:CEGUIDemo image:ArrowUpNormal" />
<Property Name="PushedImage" Value="set:CEGUIDemo image:ArrowUpPushed" />
<Property Name="DisabledImage" Value="set:CEGUIDemo image:ArrowUpDisabled" />
<Property Name="Tooltip" Value="Previous credits page" />
</Window>
<Window Name="MenuCredits/BtnNextPage" Type="CEGUIDemo/ImageButton">
<Property Name="UnifiedAreaRect" Value="{{0.9,0},{0.8,0},{0.97,0},{0.9,0}}" />
<Property Name="HoverImage" Value="set:CEGUIDemo image:ArrowDownHighlight" />
<Property Name="NormalImage" Value="set:CEGUIDemo image:ArrowDownNormal" />
<Property Name="PushedImage" Value="set:CEGUIDemo image:ArrowDownPushed" />
<Property Name="DisabledImage" Value="set:CEGUIDemo image:ArrowDownDisabled" />
<Property Name="Tooltip" Value="Next credits page" />
</Window>
<Window Name="MenuCredits/BtnBack" Type="CEGUIDemo/Button">
<Property Name="UnifiedAreaRect" Value="{{0.43,0},{0.9,0},{0.58,0},{0.95,0}}" />
@ -141,5 +39,24 @@
<Property Name="Text" Value="Back" />
<Property Name="Tooltip" Value="Back to main benu" />
</Window>
<Window Name="MenuCredits/TacCredits" Type="CEGUIDemo/TabControl">
<Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.22,0},{0.95,0},{0.85,0}}" />
<Property Name="TabHeight" Value="{0.08,0}" />
<Property Name="Font" Value="MenuMedium" />
<AutoWindow NameSuffix="__auto_TabPane__">
<Property Name="EnableBottom" Value="10" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_TabPane__Buttons">
<Property Name="EnableTop" Value="5" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_TabPane__ScrollLeft">
<Property Name="Visible" Value="False" />
</AutoWindow>
<AutoWindow NameSuffix="__auto_TabPane__ScrollRight">
<Property Name="Visible" Value="False" />
</AutoWindow>
</Window>
<!-- Note: The code will create the needed CEGUIDemo/TabContentPane instances
and insert a MultiColumn list inside each one -->
</Window>
</GUILayout>

View File

@ -3457,7 +3457,7 @@
<Image type="TopLeftCorner" imageset="CEGUIDemo" image="TabButtonUpperLeftNormal" />
<Image type="TopRightCorner" imageset="CEGUIDemo" image="TabButtonUpperRightNormal" />
<Image type="BottomLeftCorner" imageset="CEGUIDemo" image="TabButtonLowerLeftNormal" />
<Image type="BottomRightCorner" imageset="CEGUIDemo" image="TabButtonLowerRight2Normal" />
<Image type="BottomRightCorner" imageset="CEGUIDemo" image="TabButtonLowerRightNormal" />
<Image type="LeftEdge" imageset="CEGUIDemo" image="TabButtonLeftNormal" />
<Image type="RightEdge" imageset="CEGUIDemo" image="TabButtonRightNormal" />
<Image type="TopEdge" imageset="CEGUIDemo" image="TabButtonUpperNormal" />
@ -3473,7 +3473,7 @@
<Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
</Area>
<Image type="TopLeftCorner" imageset="CEGUIDemo" image="TabButtonUpperLeft2Normal" />
<Image type="TopLeftCorner" imageset="CEGUIDemo" image="TabButtonUpperLeftNormal" />
<Image type="TopRightCorner" imageset="CEGUIDemo" image="TabButtonUpperRightNormal" />
<Image type="BottomLeftCorner" imageset="CEGUIDemo" image="TabButtonLowerLeftNormal" />
<Image type="BottomRightCorner" imageset="CEGUIDemo" image="TabButtonLowerRightNormal" />
@ -3495,7 +3495,7 @@
<Image type="TopLeftCorner" imageset="CEGUIDemo" image="TabButtonUpperLeftNormal" />
<Image type="TopRightCorner" imageset="CEGUIDemo" image="TabButtonUpperRightNormal" />
<Image type="BottomLeftCorner" imageset="CEGUIDemo" image="TabButtonLowerLeftNormal" />
<Image type="BottomRightCorner" imageset="CEGUIDemo" image="TabButtonLowerRight2Normal" />
<Image type="BottomRightCorner" imageset="CEGUIDemo" image="TabButtonLowerRightNormal" />
<Image type="LeftEdge" imageset="CEGUIDemo" image="TabButtonLeftNormal" />
<Image type="RightEdge" imageset="CEGUIDemo" image="TabButtonRightNormal" />
<Image type="TopEdge" imageset="CEGUIDemo" image="TabButtonUpperNormal" />
@ -3511,7 +3511,7 @@
<Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
</Area>
<Image type="TopLeftCorner" imageset="CEGUIDemo" image="TabButtonUpperLeft2Normal" />
<Image type="TopLeftCorner" imageset="CEGUIDemo" image="TabButtonUpperLeftNormal" />
<Image type="TopRightCorner" imageset="CEGUIDemo" image="TabButtonUpperRightNormal" />
<Image type="BottomLeftCorner" imageset="CEGUIDemo" image="TabButtonLowerLeftNormal" />
<Image type="BottomRightCorner" imageset="CEGUIDemo" image="TabButtonLowerRightNormal" />

View File

@ -44,100 +44,76 @@ class MenuCredits(Menu):
name = "MenuCredits"
# Use layout if specified.
if TheConfig.useLayouts:
window = Menu.initialize(self, name=name, title="Credits", layout="menucredits")
else:
# If no layout specified, go on building up the menu through code.
window = Menu.initialize(self, name=name, title="Credits", background="SplashCredits")
# No code written for this menu : use mandatory layout.
window = Menu.initialize(self, name=name, title="Credits", layout="menucredits")
# Specific to this menu.
winMgr = PyCEGUI.WindowManager.getSingleton()
mclTable = winMgr.createWindow("CEGUIDemo/MultiColumnList", name + "/MclTable")
mclTable.setXPosition(PyCEGUI.UDim(0.1, 0.0))
mclTable.setYPosition(PyCEGUI.UDim(0.3, 0.0))
mclTable.setWidth(PyCEGUI.UDim(0.8, 0.0))
mclTable.setHeight(PyCEGUI.UDim(0.5, 0.0))
mclTable.setProperty("Font", "TextSmall")
window.addChildWindow(mclTable)
btnPrev = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/ImageButton", name + "/BtnPrevPage")
btnPrev.setTooltipText("Previous credits page")
btnPrev.setXPosition(PyCEGUI.UDim(0.9, 0.0))
btnPrev.setYPosition(PyCEGUI.UDim(0.7, 0.0))
btnPrev.setWidth(PyCEGUI.UDim(0.07, 0.0))
btnPrev.setHeight(PyCEGUI.UDim(0.1, 0.0))
btnPrev.setProperty("NormalImage", "set:CEGUIDemo image:ArrowUpNormal")
btnPrev.setProperty("HoverImage", "set:CEGUIDemo image:ArrowUpHighlight")
btnPrev.setProperty("PushedImage", "set:CEGUIDemo image:ArrowUpPushed")
btnPrev.setProperty("DisabledImage", "set:CEGUIDemo image:ArrowUpDisabled")
window.addChildWindow(btnPrev)
btnNext = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/ImageButton", name + "/BtnNextPage")
btnNext.setTooltipText("Next credits page")
btnNext.setXPosition(PyCEGUI.UDim(0.9, 0.0))
btnNext.setYPosition(PyCEGUI.UDim(0.8, 0.0))
btnNext.setWidth(PyCEGUI.UDim(0.07, 0.0))
btnNext.setHeight(PyCEGUI.UDim(0.1, 0.0))
btnNext.setProperty("NormalImage", "set:CEGUIDemo image:ArrowDownNormal")
btnNext.setProperty("HoverImage", "set:CEGUIDemo image:ArrowDownHighlight")
btnNext.setProperty("PushedImage", "set:CEGUIDemo image:ArrowDownPushed")
btnNext.setProperty("DisabledImage", "set:CEGUIDemo image:ArrowDownDisabled")
window.addChildWindow(btnNext)
btnBack = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnBack")
btnBack.setText("Back")
btnBack.setTooltipText("Back to the main menu")
btnBack.setXPosition(PyCEGUI.UDim(0.43, 0.0))
btnBack.setYPosition(PyCEGUI.UDim(0.9, 0.0))
btnBack.setWidth(PyCEGUI.UDim(0.15, 0.0))
btnBack.setHeight(PyCEGUI.UDim(0.05, 0.0))
btnBack.setProperty("Font", "MenuMedium")
window.addChildWindow(btnBack)
# Retrieve window descendants created here.
self.mclTable = window.getChild(name + "/MclTable")
self.btnPrev = window.getChild(name + "/BtnPrevPage")
self.btnNext = window.getChild(name + "/BtnNextPage")
# Retrieve window descendants created till there.
self.tacCred = window.getChild(name + "/TacCredits")
self.btnBack = window.getChild(name + "/BtnBack")
# Complete widget initialization (whatever creation mode : code or .layout).
# TODO.
self.mclTable.addColumn("Name / Role", 0, PyCEGUI.UDim(0.35, 0))
self.mclTable.addColumn("Main contributions / Contact", 1, PyCEGUI.UDim(0.65, 0))
# Ehrrrr ... well, not much ...
winMgr = PyCEGUI.WindowManager.getSingleton()
tabInd = 0
self.mclTables = []
for tabText in ("Development Team", "Contributors",
"Third party libs and tools", "Pre-fork contributors (TORCS)"):
tabPane = winMgr.createWindow("CEGUIDemo/TabContentPane",
name + "/TapCredits%d" % tabInd)
self.tacCred.addTab(tabPane)
tabPane.setText(tabText)
tabPane.setXPosition(PyCEGUI.UDim(0, 0))
tabPane.setYPosition(PyCEGUI.UDim(0, 0))
tabPane.setWidth(PyCEGUI.UDim(1, 0))
tabPane.setHeight(PyCEGUI.UDim(1, 0))
mclTable = winMgr.createWindow("CEGUIDemo/MultiColumnList",
name + "/MclTable%d" % tabInd)
tabPane.addChildWindow(mclTable)
mclTable.setXPosition(PyCEGUI.UDim(0, 0))
mclTable.setYPosition(PyCEGUI.UDim(0, 0))
mclTable.setWidth(PyCEGUI.UDim(1, 0))
mclTable.setHeight(PyCEGUI.UDim(1, 0))
mclTable.setProperty("Font", "TextSmall")
mclTable.setProperty("ColumnsMovable", "False")
mclTable.setProperty("ColumnsSizable", "True")
mclTable.setProperty("SortSettingEnabled", "False")
mclTable.addColumn("Name / Role", 0, PyCEGUI.UDim(0.35, 0))
mclTable.addColumn("Main contributions / Contact", 1, PyCEGUI.UDim(0.65, 0))
self.mclTables.append(mclTable)
tabInd += 1
# Retrieve window descendants created here.
self.tacCred = window.getChild(name + "/TacCredits")
self.btnBack = window.getChild(name + "/BtnBack")
# Complete widget initialization.
# TODO.
# Note: Keep a reference to each listbox item,
# otherwise they get garbage collected at the end of this function,
# and then CEGUI crashes of course (see below : self.lbItems.append).
self.lbItems = []
for i in range(5):
for tabInd in range(len(self.mclTables)):
for i in range(8):
rowId = self.mclTable.addRow()
rowId = self.mclTables[tabInd].addRow()
lbItem = PyCEGUI.ListboxTextItem("my name")
self.mclTable.setItem(lbItem, 0, rowId)
self.lbItems.append(lbItem)
lbItem = PyCEGUI.ListboxTextItem("my name")
self.mclTables[tabInd].setItem(lbItem, 0, rowId)
self.lbItems.append(lbItem)
lbItem = PyCEGUI.ListboxTextItem("my role")
self.mclTable.setItem(lbItem, 1, rowId)
self.lbItems.append(lbItem)
lbItem = PyCEGUI.ListboxTextItem("my role")
self.mclTables[tabInd].setItem(lbItem, 1, rowId)
self.lbItems.append(lbItem)
rowId = self.mclTable.addRow()
rowId = self.mclTables[tabInd].addRow()
lbItem = PyCEGUI.ListboxTextItem("my contribs")
self.mclTable.setItem(lbItem, 0, rowId)
self.lbItems.append(lbItem)
lbItem = PyCEGUI.ListboxTextItem("my contribs")
self.mclTables[tabInd].setItem(lbItem, 0, rowId)
self.lbItems.append(lbItem)
lbItem = PyCEGUI.ListboxTextItem("my web site")
self.mclTable.setItem(lbItem, 1, rowId)
self.lbItems.append(lbItem)
lbItem = PyCEGUI.ListboxTextItem("my web site")
self.mclTables[tabInd].setItem(lbItem, 1, rowId)
self.lbItems.append(lbItem)
return window