phoenix_title 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 Class Hierarchy

Inheritance diagram for class ZoomBar:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

wx.Control


method_summary Methods Summary

__init__

Default class constructor.

AddButton

Adds a button to ZoomBar.

AddSeparator

Adds a separator to ZoomBar.

DoGetBestSize

Gets the size which best suits the window: for a control, it would be the

DoLayout

Common method to re-layout ZoomBar.

DrawButtons

Draws all the main button bitmaps on the ZoomBar client window.

DrawLabels

Draws all the button labels on the ZoomBar client window.

DrawReflections

Draws all the reflection button bitmaps on the ZoomBar client window.

EnableButton

Enables/disables the button at position index.

GetBarColour

Returns the background button bar colour.

GetButtonSize

Returns the original (not zoomed) button size, in pixels.

GetCenterZoom

Returns True if buttons zoom upwards.

GetShowLabels

Returns True if button labels are currently shown.

GetShowReflections

Returns True if reflections bitmap are currently shown.

GetZoomFactor

Returns the current zoom factor.

HitTest

HitTest method for ZoomBar.

InitialReposition

Sets up the initial buttons and sizes them from the center.

IsButtonEnabled

Returns True if the button at position index is enabled, False

OnEraseBackground

Handles the wx.EVT_ERASE_BACKGROUND event for ZoomBar.

OnLeaveWindow

Handles the wx.EVT_LEAVE_WINDOW event for ZoomBar.

OnLeftDown

Handles the wx.EVT_LEFT_DOWN and wx.EVT_LEFT_DCLICK events for ZoomBar.

OnLeftUp

Handles the wx.EVT_LEFT_UP event for ZoomBar.

OnMotion

Handles the wx.EVT_MOTION event for ZoomBar.

OnPaint

Handles the wx.EVT_PAINT event for ZoomBar.

OnSize

Handles the wx.EVT_SIZE event for ZoomBar.

Reposition

Repositions all the buttons inside the ZoomBar.

ResetSize

Resets all the button sizes and positions, recalculating the optimal ZoomBar

SetBarColour

Sets the background button bar colour.

SetButtonSize

Sets the original button size.

SetCenterZoom

Sets to zoom from the center.

SetShowLabels

Sets whether to show button labels or not.

SetShowReflections

Sets whether to show reflections or not.

SetZoomFactor

Sets the zoom factor for all the buttons. Larger number gives a greater zoom

SnapToBottom

Snaps the background button bar bitmap and all the buttons to the bottom


api Class API

class ZoomBar(wx.Control)

ZoomBar is a class that appoximatively mimics the behaviour of the Mac Dock, inside a Panel.

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 be None;

  • 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.



AddSeparator(self, normalBmp, reflectionBmp=wx.NullBitmap)

Adds a separator to ZoomBar.

Parameters
  • normalBmp – the separator main bitmap, an instance of wx.Bitmap;

  • reflectionBmp – a bitmap representing a reflection of the main bitmap, 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.



DoLayout(self)

Common method to re-layout ZoomBar.



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;

  • enableTrue 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 for ZoomBar.

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 for ZoomBar.

Parameters

event – a MouseEvent event to be processed.



OnLeftDown(self, event)

Handles the wx.EVT_LEFT_DOWN and wx.EVT_LEFT_DCLICK events for ZoomBar.

Parameters

event – a MouseEvent event to be processed.



OnLeftUp(self, event)

Handles the wx.EVT_LEFT_UP event for ZoomBar.

Parameters

event – a MouseEvent event to be processed.



OnMotion(self, event)

Handles the wx.EVT_MOTION event for ZoomBar.

Parameters

event – a MouseEvent event to be processed.



OnPaint(self, event)

Handles the wx.EVT_PAINT event for ZoomBar.

Parameters

event – a PaintEvent event to be processed.



OnSize(self, event)

Handles the wx.EVT_SIZE event for ZoomBar.

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).



ResetSize(self)

Resets all the button sizes and positions, recalculating the optimal ZoomBar size.



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

showTrue to show button labels, False otherwise.



SetShowReflections(self, show)

Sets whether to show reflections or not.

Parameters

showTrue 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.



SnapToBottom(self, size)

Snaps the background button bar bitmap and all the buttons to the bottom of ZoomBar.

Parameters

size – the current ZoomBar size.