wx.lib.agw.zoombar.ZoomBar¶
ZoomBar is a class that appoximatively mimics the behaviour of the Mac Dock,
inside a Panel.
This is the main class implementation.
Class Hierarchy¶
Control Appearance¶
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Adds a button to |
|
Adds a separator to |
|
Gets the size which best suits the window: for a control, it would be the |
|
Common method to re-layout |
|
Draws all the main button bitmaps on the |
|
Draws all the button labels on the |
|
Draws all the reflection button bitmaps on the |
|
Enables/disables the button at position index. |
|
Returns the background button bar colour. |
|
Returns the original (not zoomed) button size, in pixels. |
|
Returns |
|
Returns |
|
Returns |
|
Returns the current zoom factor. |
|
HitTest method for |
|
Sets up the initial buttons and sizes them from the center. |
|
Returns |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Repositions all the buttons inside the |
|
Resets all the button sizes and positions, recalculating the optimal |
|
Sets the background button bar colour. |
|
Sets the original button size. |
|
Sets to zoom from the center. |
|
Sets whether to show button labels or not. |
|
Sets whether to show reflections or not. |
|
Sets the zoom factor for all the buttons. Larger number gives a greater zoom |
|
Snaps the background button bar bitmap and all the buttons to the bottom |
Class API¶
- class ZoomBar(wx.Control)¶
ZoomBaris a class that appoximatively mimics the behaviour of the Mac Dock, inside aPanel.This is the main class implementation.
Methods¶
- __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, name='ZoomBar')¶
Default class constructor.
- Parameters:
parent – the
ZoomBarparent. Must not beNone;id – window identifier. A value of -1 indicates a default value;
pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
name – the window name.
- AddButton(self, normalBmp, reflectionBmp=wx.NullBitmap, label='', disabledBmp=wx.NullBitmap, disabledReflectionBmp=wx.NullBitmap)¶
Adds a button to
ZoomBar.- Parameters:
normalBmp – the button main bitmap, an instance of
wx.Bitmap;reflectionBmp – a bitmap representing a reflection of the main bitmap, an instance of
wx.Bitmap;label – the button label;
disabledBmp – the button main bitmap when the button is in a disabled state, an instance of
wx.Bitmap;disabledReflectionBmp – a bitmap representing a reflection of the main bitmap, when the button is in a disabled state, an instance of
wx.Bitmap.
- DoGetBestSize(self)¶
Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().
Note
Overridden from
wx.Control.
- DrawButtons(self, dc)¶
Draws all the main button bitmaps on the
ZoomBarclient window.- Parameters:
dc – an instance of
wx.DC.
- DrawLabels(self, dc)¶
Draws all the button labels on the
ZoomBarclient window.- Parameters:
dc – an instance of
wx.DC.
- DrawReflections(self, dc)¶
Draws all the reflection button bitmaps on the
ZoomBarclient window.- Parameters:
dc – an instance of
wx.DC.
- EnableButton(self, index, enable=True)¶
Enables/disables the button at position index.
- Parameters:
index – the index of the button to enable/disable;
enable –
Trueto enable the button,Falseto disable it.
- GetBarColour(self)¶
Returns the background button bar colour.
- GetButtonSize(self)¶
Returns the original (not zoomed) button size, in pixels.
- GetCenterZoom(self)¶
Returns
Trueif buttons zoom upwards.
- GetShowLabels(self)¶
Returns
Trueif button labels are currently shown.
- GetShowReflections(self)¶
Returns
Trueif reflections bitmap are currently shown.
- GetZoomFactor(self)¶
Returns the current zoom factor.
- HitTest(self, pos)¶
HitTest method for
ZoomBar.- Parameters:
pos – the current mouse position.
- Returns:
an index representing the button on which the mouse is hovering, or
wx.NOT_FOUNDif no button has been hit.
- InitialReposition(self)¶
Sets up the initial buttons and sizes them from the center.
- IsButtonEnabled(self, index)¶
Returns
Trueif the button at position index is enabled,Falseotherwise.- Parameters:
index – the index of the button to check.
- OnEraseBackground(self, event)¶
Handles the
wx.EVT_ERASE_BACKGROUNDevent forZoomBar.- Parameters:
event – a
EraseEventevent to be processed.
Note
This method is intentionally empty to avoid flicker.
- OnLeaveWindow(self, event)¶
Handles the
wx.EVT_LEAVE_WINDOWevent forZoomBar.- Parameters:
event – a
MouseEventevent to be processed.
- OnLeftDown(self, event)¶
Handles the
wx.EVT_LEFT_DOWNandwx.EVT_LEFT_DCLICKevents forZoomBar.- Parameters:
event – a
MouseEventevent to be processed.
- OnLeftUp(self, event)¶
Handles the
wx.EVT_LEFT_UPevent forZoomBar.- Parameters:
event – a
MouseEventevent to be processed.
- OnMotion(self, event)¶
Handles the
wx.EVT_MOTIONevent forZoomBar.- Parameters:
event – a
MouseEventevent to be processed.
- OnPaint(self, event)¶
Handles the
wx.EVT_PAINTevent forZoomBar.- Parameters:
event – a
PaintEventevent to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZEevent forZoomBar.- Parameters:
event – a
wx.SizeEventevent to be processed.
- Reposition(self, toButton)¶
Repositions all the buttons inside the
ZoomBar.- Parameters:
toButton – the button currently hovered by the mouse (and hence zoomed).
- SetBarColour(self, colour)¶
Sets the background button bar colour.
- Parameters:
colour – an instance of
wx.Colour;
- SetButtonSize(self, size)¶
Sets the original button size.
- Parameters:
size – the new (not-zoomed) button size, in pixels.
- SetCenterZoom(self, center=True)¶
Sets to zoom from the center.
- Parameters:
center – if
Truebutton zooms upwards.
- SetShowLabels(self, show)¶
Sets whether to show button labels or not.
- Parameters:
show –
Trueto show button labels,Falseotherwise.
- SetShowReflections(self, show)¶
Sets whether to show reflections or not.
- Parameters:
show –
Trueto show reflections,Falseotherwise.
- SetZoomFactor(self, zoom)¶
Sets the zoom factor for all the buttons. Larger number gives a greater zoom effect.
- Parameters:
zoom – a floating point number, greater than or equal to 1.0.