.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.zoombar
.. highlight:: python
.. _wx.lib.agw.zoombar.ZoomBar:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.zoombar.ZoomBar**
==========================================================================================================================================
:class:`ZoomBar` is a class that *appoximatively* mimics the behaviour of the Mac Dock,
inside a :class:`Panel`.
This is the main class implementation.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
ZoomBar:
|
|appearance| Control Appearance
===============================
|
.. container:: control-appearance-figures
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.zoombar.zoombar.png
:alt: wxMSW
:figclass: appearance-figure
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: appearance-figure
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.agw.zoombar.zoombar.png
:alt: wxGTK
:figclass: appearance-figure
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.Control`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.zoombar.ZoomBar.__init__` Default class constructor.
:meth:`~wx.lib.agw.zoombar.ZoomBar.AddButton` Adds a button to :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.AddSeparator` Adds a separator to :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.DoGetBestSize` Gets the size which best suits the window: for a control, it would be the
:meth:`~wx.lib.agw.zoombar.ZoomBar.DoLayout` Common method to re-layout :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.DrawButtons` Draws all the main button bitmaps on the :class:`ZoomBar` client window.
:meth:`~wx.lib.agw.zoombar.ZoomBar.DrawLabels` Draws all the button labels on the :class:`ZoomBar` client window.
:meth:`~wx.lib.agw.zoombar.ZoomBar.DrawReflections` Draws all the reflection button bitmaps on the :class:`ZoomBar` client window.
:meth:`~wx.lib.agw.zoombar.ZoomBar.EnableButton` Enables/disables the button at position `index`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.GetBarColour` Returns the background button bar colour.
:meth:`~wx.lib.agw.zoombar.ZoomBar.GetButtonSize` Returns the original (not zoomed) button size, in pixels.
:meth:`~wx.lib.agw.zoombar.ZoomBar.GetCenterZoom` Returns ``True`` if buttons zoom upwards.
:meth:`~wx.lib.agw.zoombar.ZoomBar.GetShowLabels` Returns ``True`` if button labels are currently shown.
:meth:`~wx.lib.agw.zoombar.ZoomBar.GetShowReflections` Returns ``True`` if reflections bitmap are currently shown.
:meth:`~wx.lib.agw.zoombar.ZoomBar.GetZoomFactor` Returns the current zoom factor.
:meth:`~wx.lib.agw.zoombar.ZoomBar.HitTest` HitTest method for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.InitialReposition` Sets up the initial buttons and sizes them from the center.
:meth:`~wx.lib.agw.zoombar.ZoomBar.IsButtonEnabled` Returns ``True`` if the button at position `index` is enabled, ``False``
:meth:`~wx.lib.agw.zoombar.ZoomBar.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.OnLeaveWindow` Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.OnLeftDown` Handles the ``wx.EVT_LEFT_DOWN`` and ``wx.EVT_LEFT_DCLICK`` events for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.OnLeftUp` Handles the ``wx.EVT_LEFT_UP`` event for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.OnMotion` Handles the ``wx.EVT_MOTION`` event for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.Reposition` Repositions all the buttons inside the :class:`ZoomBar`.
:meth:`~wx.lib.agw.zoombar.ZoomBar.ResetSize` Resets all the button sizes and positions, recalculating the optimal :class:`ZoomBar`
:meth:`~wx.lib.agw.zoombar.ZoomBar.SetBarColour` Sets the background button bar colour.
:meth:`~wx.lib.agw.zoombar.ZoomBar.SetButtonSize` Sets the original button size.
:meth:`~wx.lib.agw.zoombar.ZoomBar.SetCenterZoom` Sets to zoom from the center.
:meth:`~wx.lib.agw.zoombar.ZoomBar.SetShowLabels` Sets whether to show button labels or not.
:meth:`~wx.lib.agw.zoombar.ZoomBar.SetShowReflections` Sets whether to show reflections or not.
:meth:`~wx.lib.agw.zoombar.ZoomBar.SetZoomFactor` Sets the zoom factor for all the buttons. Larger number gives a greater zoom
:meth:`~wx.lib.agw.zoombar.ZoomBar.SnapToBottom` Snaps the background button bar bitmap and all the buttons to the bottom
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: ZoomBar(wx.Control)
:class:`ZoomBar` is a class that *appoximatively* mimics the behaviour of the Mac Dock,
inside a :class:`Panel`.
This is the main class implementation.
.. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, name="ZoomBar")
Default class constructor.
:param `parent`: the :class:`ZoomBar` parent. Must not be ``None``;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:param `name`: the window name.
.. method:: AddButton(self, normalBmp, reflectionBmp=wx.NullBitmap, label="", disabledBmp=wx.NullBitmap, disabledReflectionBmp=wx.NullBitmap)
Adds a button to :class:`ZoomBar`.
:param `normalBmp`: the button main bitmap, an instance of :class:`wx.Bitmap`;
:param `reflectionBmp`: a bitmap representing a reflection of the main bitmap,
an instance of :class:`wx.Bitmap`;
:param `label`: the button label;
:param `disabledBmp`: the button main bitmap when the button is in a disabled
state, an instance of :class:`wx.Bitmap`;
:param `disabledReflectionBmp`: a bitmap representing a reflection of the main bitmap,
when the button is in a disabled state, an instance of :class:`wx.Bitmap`.
.. method:: AddSeparator(self, normalBmp, reflectionBmp=wx.NullBitmap)
Adds a separator to :class:`ZoomBar`.
:param `normalBmp`: the separator main bitmap, an instance of :class:`wx.Bitmap`;
:param `reflectionBmp`: a bitmap representing a reflection of the main bitmap,
an instance of :class:`wx.Bitmap`.
.. method:: 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 :class:`wx.Control`.
.. method:: DoLayout(self)
Common method to re-layout :class:`ZoomBar`.
.. method:: DrawButtons(self, dc)
Draws all the main button bitmaps on the :class:`ZoomBar` client window.
:param `dc`: an instance of :class:`wx.DC`.
.. method:: DrawLabels(self, dc)
Draws all the button labels on the :class:`ZoomBar` client window.
:param `dc`: an instance of :class:`wx.DC`.
.. method:: DrawReflections(self, dc)
Draws all the reflection button bitmaps on the :class:`ZoomBar` client window.
:param `dc`: an instance of :class:`wx.DC`.
.. method:: EnableButton(self, index, enable=True)
Enables/disables the button at position `index`.
:param `index`: the index of the button to enable/disable;
:param `enable`: ``True`` to enable the button, ``False`` to disable it.
.. method:: GetBarColour(self)
Returns the background button bar colour.
.. method:: GetButtonSize(self)
Returns the original (not zoomed) button size, in pixels.
.. method:: GetCenterZoom(self)
Returns ``True`` if buttons zoom upwards.
.. method:: GetShowLabels(self)
Returns ``True`` if button labels are currently shown.
.. method:: GetShowReflections(self)
Returns ``True`` if reflections bitmap are currently shown.
.. method:: GetZoomFactor(self)
Returns the current zoom factor.
.. method:: HitTest(self, pos)
HitTest method for :class:`ZoomBar`.
:param `pos`: the current mouse position.
:return: an index representing the button on which the mouse is hovering,
or ``wx.NOT_FOUND`` if no button has been hit.
.. method:: InitialReposition(self)
Sets up the initial buttons and sizes them from the center.
.. method:: IsButtonEnabled(self, index)
Returns ``True`` if the button at position `index` is enabled, ``False``
otherwise.
:param `index`: the index of the button to check.
.. method:: OnEraseBackground(self, event)
Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`ZoomBar`.
:param `event`: a :class:`EraseEvent` event to be processed.
.. note:: This method is intentionally empty to avoid flicker.
.. method:: OnLeaveWindow(self, event)
Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`ZoomBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnLeftDown(self, event)
Handles the ``wx.EVT_LEFT_DOWN`` and ``wx.EVT_LEFT_DCLICK`` events for :class:`ZoomBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnLeftUp(self, event)
Handles the ``wx.EVT_LEFT_UP`` event for :class:`ZoomBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnMotion(self, event)
Handles the ``wx.EVT_MOTION`` event for :class:`ZoomBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnPaint(self, event)
Handles the ``wx.EVT_PAINT`` event for :class:`ZoomBar`.
:param `event`: a :class:`PaintEvent` event to be processed.
.. method:: OnSize(self, event)
Handles the ``wx.EVT_SIZE`` event for :class:`ZoomBar`.
:param `event`: a :class:`wx.SizeEvent` event to be processed.
.. method:: Reposition(self, toButton)
Repositions all the buttons inside the :class:`ZoomBar`.
:param `toButton`: the button currently hovered by the mouse (and hence zoomed).
.. method:: ResetSize(self)
Resets all the button sizes and positions, recalculating the optimal :class:`ZoomBar`
size.
.. method:: SetBarColour(self, colour)
Sets the background button bar colour.
:param `colour`: an instance of :class:`wx.Colour`;
.. method:: SetButtonSize(self, size)
Sets the original button size.
:param `size`: the new (not-zoomed) button size, in pixels.
.. method:: SetCenterZoom(self, center=True)
Sets to zoom from the center.
:param `center`: if ``True`` button zooms upwards.
.. method:: SetShowLabels(self, show)
Sets whether to show button labels or not.
:param `show`: ``True`` to show button labels, ``False`` otherwise.
.. method:: SetShowReflections(self, show)
Sets whether to show reflections or not.
:param `show`: ``True`` to show reflections, ``False`` otherwise.
.. method:: SetZoomFactor(self, zoom)
Sets the zoom factor for all the buttons. Larger number gives a greater zoom
effect.
:param `zoom`: a floating point number, greater than or equal to 1.0.
.. method:: SnapToBottom(self, size)
Snaps the background button bar bitmap and all the buttons to the bottom
of :class:`ZoomBar`.
:param `size`: the current :class:`ZoomBar` size.