Commits

Jason McKesson committed f1d90b9

Box containers can now have any kind of layout they want, not just box layout.

  • Participants
  • Parent commits f6d1ee6

Comments (0)

Files changed (4)

File Docs/LuaGUI.xml

                 <para>A box is defined by the <classname>box</classname> element. This is a fairly
                     simple container; it draws a box around its contents, visually separating them
                     from the windows around it.</para>
-                <note>
-                    <para>Currently, the box container does not have the expected layout attributes.
-                        It only can have box-style layout, and this is specified by the
-                            <literal>orient</literal> attributes, rather than the
-                            <literal>box.orient</literal> attribute. This is done to emphasize the
-                        fact that boxes are special.</para>
-                </note>
                 <glosslist>
                     <title>Box Attributes</title>
                     <glossentry>
                                 Required.</para>
                         </glossdef>
                     </glossentry>
-                    <glossentry>
-                        <glossterm>orient</glossterm>
-                        <glossdef>
-                            <para>Defines the stacking direction of the radio buttons. If this is
-                                        <quote><literal>horizontal</literal>,</quote> then the radio
-                                buttons are stacked left-to-right, and if this is
-                                        <quote><literal>vertical</literal>,</quote> they are stacked
-                                top-to-bottom.</para>
-                            <para>Optional. Defaults to
-                                <quote><literal>vertical</literal>.</quote></para>
-                        </glossdef>
-                    </glossentry>
                 </glosslist>
             </section>
             <section>

File Docs/luagui.rnc

         lg.std.window.attlist,
         lg.size,
         lg.positioning.attlist,
-        lg.orient.attribute?
+        lg.sizer.attlist?
     
     lg.tab.attlist =
         lg.text.attribute,

File Testing/LuaGuiTest.xml

             </tabs>
         </panel>
         <panel title="Right" box.orient="vertical" width="340" expand="true" direction="right" maximizebutton="true">
-            <box border="0" text="Game" expand="true" orient="horizontal">
+            <box border="0" text="Game" expand="true" grid.numCols="1" grid.colProportion="0=1">
                 <button proportion="1" text="Left" expand="true"/>
                 <button proportion="1" text="Right" expand="true"/>
             </box>

File Tools/LuaGUI.lua

 
 local function CalcGridProportions(strGridProport)
 	local ret = {};
-	print("here!");
 	for colRow, proportion in strGridProport:gmatch("(%d+)=(%d+)") do
-		print("during!");
 		ret[tonumber(colRow)] = tonumber(proportion);
 	end
-	print("after!");
 	return ret;
 end
 
 elementJumpTable.panel = elementJumpTable["toolbar"];
 
 function elementJumpTable.box(parWnd, sizer, currNode, notebook, auiNotebook)
-	local orient = GetOrientation(currNode);
 	local size = GetNodeSize(currNode);
 	local staticBox = wx.wxStaticBox(parWnd, wx.wxID_ANY,
 		currNode:GetPropVal("text", "Box With No Name"), wx.wxDefaultPosition, size);
 	
-	local boxSizer = wx.wxStaticBoxSizer(staticBox, orient);
+	--Creates a sizer as needed for static box containment.
+	local boxSizer = wx.wxStaticBoxSizer(staticBox, wx.wxVERTICAL);
 	boxSizer:SetMinSize(size);
 	
-	ParseChildrenWithCallback(parWnd, boxSizer, currNode, notebook, auiNotebook, nil);
+	--Creates a sizer the usual way.
+	local newSizer = CreateStandardSizer(currNode);
+	newSizer:SetMinSize(size);
+
+	ParseChildrenWithCallback(parWnd, newSizer, currNode, notebook, auiNotebook, nil);
+	
+	--Make our internal sizer as big as is allowed. It is the only child of
+	--the outer box sizer.
+	boxSizer:Add(newSizer, 1, wx.wxEXPAND, 0);
 
 	FinalizeControl(currNode, staticBox);
 	AddToSizer(currNode, boxSizer, sizer);