.. include:: headings.inc .. currentmodule:: lib.buttons .. highlight:: python .. _lib.buttons.GenButton: ========================================================================================================================================== |phoenix_title| **GenButton** ========================================================================================================================================== A generic button, and base class for the other generic buttons. | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **GenButton** .. raw:: html

Inheritance diagram of GenButton

| |sub_classes| Known Subclasses ============================== :class:`lib.buttons.GenBitmapButton`, :class:`lib.buttons.GenToggleButton`, :class:`lib.buttons.ThemedGenButton` | |super_classes| Known Superclasses ================================== :class:`PyControl` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~lib.buttons.GenButton.__init__` :meth:`~lib.buttons.GenButton.AcceptsFocus` Overridden base class virtual. :meth:`~lib.buttons.GenButton.DoGetBestSize` Overridden base class virtual. Determines the best size of the :meth:`~lib.buttons.GenButton.DrawBezel` :meth:`~lib.buttons.GenButton.DrawFocusIndicator` :meth:`~lib.buttons.GenButton.DrawLabel` :meth:`~lib.buttons.GenButton.Enable` :meth:`~lib.buttons.GenButton.GetBackgroundBrush` :meth:`~lib.buttons.GenButton.GetBezelWidth` Return the width of the 3D effect :meth:`~lib.buttons.GenButton.GetDefaultAttributes` Overridden base class virtual. By default we should use :meth:`~lib.buttons.GenButton.GetUseFocusIndicator` Return focus indicator flag :meth:`~lib.buttons.GenButton.InitColours` Calculate a new set of highlight and shadow colours based on :meth:`~lib.buttons.GenButton.InitOtherEvents` Override in a subclass to initialize any other events that :meth:`~lib.buttons.GenButton.Notify` :meth:`~lib.buttons.GenButton.OnGainFocus` :meth:`~lib.buttons.GenButton.OnKeyDown` :meth:`~lib.buttons.GenButton.OnKeyUp` :meth:`~lib.buttons.GenButton.OnLeftDown` :meth:`~lib.buttons.GenButton.OnLeftUp` :meth:`~lib.buttons.GenButton.OnLoseFocus` :meth:`~lib.buttons.GenButton.OnMotion` :meth:`~lib.buttons.GenButton.OnPaint` :meth:`~lib.buttons.GenButton.OnSize` :meth:`~lib.buttons.GenButton.SetBackgroundColour` :meth:`~lib.buttons.GenButton.SetBezelWidth` Set the width of the 3D effect :meth:`~lib.buttons.GenButton.SetDefault` :meth:`~lib.buttons.GenButton.SetForegroundColour` :meth:`~lib.buttons.GenButton.SetInitialSize` Given the current font and bezel width settings, calculate :meth:`~lib.buttons.GenButton.SetUseFocusIndicator` Specifiy if a focus indicator (dotted line) should be used :meth:`~lib.buttons.GenButton.ShouldInheritColours` Overridden base class virtual. Buttons usually don't inherit ================================================================================ ================================================================================ | |api| Class API =============== .. class:: GenButton(PyControl) A generic button, and base class for the other generic buttons. .. method:: __init__(self, parent, id=-1, label='', pos = DefaultPosition, size = DefaultSize, style = 0, validator = DefaultValidator, name = "genbutton") .. method:: AcceptsFocus(self) Overridden base class virtual. .. method:: DoGetBestSize(self) Overridden base class virtual. Determines the best size of the button based on the label and bezel size. .. method:: DrawBezel(self, dc, x1, y1, x2, y2) .. method:: DrawFocusIndicator(self, dc, w, h) .. method:: DrawLabel(self, dc, width, height, dx=0, dy=0) .. method:: Enable(self, enable=True) .. method:: GetBackgroundBrush(self, dc) .. method:: GetBezelWidth(self) Return the width of the 3D effect .. method:: GetDefaultAttributes(self) Overridden base class virtual. By default we should use the same font/colour attributes as the native Button. .. method:: GetUseFocusIndicator(self) Return focus indicator flag .. method:: InitColours(self) Calculate a new set of highlight and shadow colours based on the background colour. Works okay if the colour is dark... .. method:: InitOtherEvents(self) Override in a subclass to initialize any other events that need to be bound. Added so __init__ doesn't need to be overriden, which is complicated with multiple inheritance .. method:: Notify(self) .. method:: OnGainFocus(self, event) .. method:: OnKeyDown(self, event) .. method:: OnKeyUp(self, event) .. method:: OnLeftDown(self, event) .. method:: OnLeftUp(self, event) .. method:: OnLoseFocus(self, event) .. method:: OnMotion(self, event) .. method:: OnPaint(self, event) .. method:: OnSize(self, event) .. method:: SetBackgroundColour(self, colour) .. method:: SetBezelWidth(self, width) Set the width of the 3D effect .. method:: SetDefault(self) .. method:: SetForegroundColour(self, colour) .. method:: SetInitialSize(self, size=None) Given the current font and bezel width settings, calculate and set a good size. .. method:: SetUseFocusIndicator(self, flag) Specifiy if a focus indicator (dotted line) should be used .. method:: ShouldInheritColours(self) Overridden base class virtual. Buttons usually don't inherit the parent's colours.