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)¶
ZoomBar
is 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
ZoomBar
parent. 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
ZoomBar
client window.- Parameters:
dc – an instance of
wx.DC
.
- DrawLabels(self, dc)¶
Draws all the button labels on the
ZoomBar
client window.- Parameters:
dc – an instance of
wx.DC
.
- DrawReflections(self, dc)¶
Draws all the reflection button bitmaps on the
ZoomBar
client 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 –
True
to enable the button,False
to disable it.
- GetBarColour(self)¶
Returns the background button bar colour.
- GetButtonSize(self)¶
Returns the original (not zoomed) button size, in pixels.
- GetCenterZoom(self)¶
Returns
True
if buttons zoom upwards.
- GetShowLabels(self)¶
Returns
True
if button labels are currently shown.
- GetShowReflections(self)¶
Returns
True
if 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_FOUND
if no button has been hit.
- InitialReposition(self)¶
Sets up the initial buttons and sizes them from the center.
- IsButtonEnabled(self, index)¶
Returns
True
if the button at position index is enabled,False
otherwise.- Parameters:
index – the index of the button to check.
- OnEraseBackground(self, event)¶
Handles the
wx.EVT_ERASE_BACKGROUND
event forZoomBar
.- Parameters:
event – a
EraseEvent
event to be processed.
Note
This method is intentionally empty to avoid flicker.
- OnLeaveWindow(self, event)¶
Handles the
wx.EVT_LEAVE_WINDOW
event forZoomBar
.- Parameters:
event – a
MouseEvent
event to be processed.
- OnLeftDown(self, event)¶
Handles the
wx.EVT_LEFT_DOWN
andwx.EVT_LEFT_DCLICK
events forZoomBar
.- Parameters:
event – a
MouseEvent
event to be processed.
- OnLeftUp(self, event)¶
Handles the
wx.EVT_LEFT_UP
event forZoomBar
.- Parameters:
event – a
MouseEvent
event to be processed.
- OnMotion(self, event)¶
Handles the
wx.EVT_MOTION
event forZoomBar
.- Parameters:
event – a
MouseEvent
event to be processed.
- OnPaint(self, event)¶
Handles the
wx.EVT_PAINT
event forZoomBar
.- Parameters:
event – a
PaintEvent
event to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZE
event forZoomBar
.- Parameters:
event – a
wx.SizeEvent
event 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
True
button zooms upwards.
- SetShowLabels(self, show)¶
Sets whether to show button labels or not.
- Parameters:
show –
True
to show button labels,False
otherwise.
- SetShowReflections(self, show)¶
Sets whether to show reflections or not.
- Parameters:
show –
True
to show reflections,False
otherwise.
- 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.