Features/New Toolbar Design: Difference between revisions

Line 21: Line 21:


== Detailed Description ==
== Detailed Description ==
''Expand on the summary, if appropriateA couple sentences suffices to explain the goal, but the more details you can provide the better.''
 
sugar.graphics.toolbar module consists of 2 widgets:
* ''Toolbar'' main widget which represents toolbar itself
* ''ToolbarButton'' tool button to insert to ''Toolbar'', which could be expanded to sub-widget
 
NOTE: Toolbar was designed to have only one level of sub-widgets.
 
==== Toolbar ====
 
sugar.graphics.toolbar.Toolbar extends gtk.VBox:
* ''top'' property to access to gtk.Toolbar interface
* ''modify_bg'' to modify background color of toolbar itself and all sub-widgets
 
==== ToolbarButton ====
 
sugar.graphics.toolbar.ToolbarButton extends sugar.graphics.toolbutton.ToolButton:
* ''toolbar'' RO property, if parent of button is sugar.graphics.toolbar.Toolbar
* ''page'' RW GObject property, sub-widget to expand
* ''expanded'' RW property, if ''page'' expanded
 
If sugar.graphics.toolbar.Toolbar.palette property wasn't set manually it will contain palette with ''page''.
 
==== Example ====
 
from sugar.graphics.toolbar import Toolbar, ToolbarButton
toolbar = Toolbar()
  tollbarbutton_1 = ToolbarButton(
        page=gtk.Button('sub-widget #1'),
        icon_name='computer-xo')
toolbar.top.insert(tollbarbutton_1, -1)
tollbarbutton_2 = ToolbarButton(
        page=gtk.Button('sub-widget #2'),
        icon_name='button_cancel',
        tooltip='with custom palette instead of sub-widget')
toolbar.top.insert(tollbarbutton_2, -1)


== Benefit to Sugar ==
== Benefit to Sugar ==