GUI: hide the quad tree path entry widget by default

This commit is contained in:
hasufell 2014-11-15 00:32:16 +01:00
parent d5741d3839
commit c964afee10
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 60 additions and 34 deletions

View File

@ -54,7 +54,9 @@ data MyGUI = MkMyGUI {
-- |coord check button
cC :: CheckButton,
-- |Path entry widget for the quad tree.
pE :: Entry
pE :: Entry,
-- |Horizontal box containing the path entry widget.
vbox7 :: Box
}
@ -87,6 +89,7 @@ makeMyGladeGUI = do
<*> xmlGetWidget xml castToCheckButton "gridcheckbutton"
<*> xmlGetWidget xml castToCheckButton "coordcheckbutton"
<*> xmlGetWidget xml castToEntry "path"
<*> xmlGetWidget xml castToBox "vbox7"
-- |Main entry point for the GTK GUI routines.
@ -122,6 +125,7 @@ makeGUI startFile = do
_ <- onExpose (da mygui) (\_ -> drawDiag mygui >>=
(\_ -> return True))
_ <- on (cB mygui) changed (drawDiag mygui)
_ <- on (cB mygui) changed (showPathWidget mygui)
_ <- on (gC mygui) toggled (drawDiag mygui)
_ <- on (cC mygui) toggled (drawDiag mygui)
@ -145,6 +149,7 @@ makeGUI startFile = do
-- draw widgets and start main loop
widgetShowAll (win mygui)
widgetHide (vbox7 mygui)
mainGUI
@ -160,6 +165,16 @@ showErrorDialog str = do
widgetDestroy errorDialog
-- |May hide or show the widget that holds the quad tree path entry,
-- depending on the context.
showPathWidget :: MyGUI
-> IO ()
showPathWidget mygui = do
item <- comboBoxGetActive (cB mygui)
if item == 4 then widgetShow (vbox7 mygui) else widgetHide (vbox7 mygui)
return ()
-- |Draws a Diagram which is built from a given file to
-- the gtk DrawingArea.
drawDiag :: MyGUI

View File

@ -785,6 +785,10 @@ Public License instead of this License.
<property name="position">5</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<widget class="GtkHBox" id="hbox5">
<property name="visible">True</property>
@ -820,9 +824,9 @@ Public License instead of this License.
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">6</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -834,7 +838,14 @@ Public License instead of this License.
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">7</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">6</property>
</packing>
</child>
<child>
@ -850,7 +861,7 @@ Show quad tree squares</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">8</property>
<property name="position">7</property>
</packing>
</child>
</widget>