Table Of Contents

Previous topic

GenBitmapToggleButton

Next topic

GenButtonEvent

This Page

phoenix_title GenButton

A generic button, and base class for the other generic buttons.


class_hierarchy Inheritance Diagram

Inheritance diagram for class GenButton

Inheritance diagram of GenButton


super_classes Known Superclasses

PyControl


method_summary Methods Summary

__init__  
AcceptsFocus Overridden base class virtual.
DoGetBestSize Overridden base class virtual. Determines the best size of the
DrawBezel  
DrawFocusIndicator  
DrawLabel  
Enable  
GetBackgroundBrush  
GetBezelWidth Return the width of the 3D effect
GetDefaultAttributes Overridden base class virtual. By default we should use
GetUseFocusIndicator Return focus indicator flag
InitColours Calculate a new set of highlight and shadow colours based on
InitOtherEvents Override in a subclass to initialize any other events that
Notify  
OnGainFocus  
OnKeyDown  
OnKeyUp  
OnLeftDown  
OnLeftUp  
OnLoseFocus  
OnMotion  
OnPaint  
OnSize  
SetBackgroundColour  
SetBezelWidth Set the width of the 3D effect
SetDefault  
SetForegroundColour  
SetInitialSize Given the current font and bezel width settings, calculate
SetUseFocusIndicator Specifiy if a focus indicator (dotted line) should be used
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.


Methods



__init__(self, parent, id=-1, label='', pos = DefaultPosition, size = DefaultSize, style = 0, validator = DefaultValidator, name = "genbutton")


AcceptsFocus(self)

Overridden base class virtual.



DoGetBestSize(self)

Overridden base class virtual. Determines the best size of the button based on the label and bezel size.



DrawBezel(self, dc, x1, y1, x2, y2)


DrawFocusIndicator(self, dc, w, h)


DrawLabel(self, dc, width, height, dx=0, dy=0)


Enable(self, enable=True)


GetBackgroundBrush(self, dc)


GetBezelWidth(self)

Return the width of the 3D effect



GetDefaultAttributes(self)

Overridden base class virtual. By default we should use the same font/colour attributes as the native Button.



GetUseFocusIndicator(self)

Return focus indicator flag



InitColours(self)

Calculate a new set of highlight and shadow colours based on the background colour. Works okay if the colour is dark...



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



Notify(self)


OnGainFocus(self, event)


OnKeyDown(self, event)


OnKeyUp(self, event)


OnLeftDown(self, event)


OnLeftUp(self, event)


OnLoseFocus(self, event)


OnMotion(self, event)


OnPaint(self, event)


OnSize(self, event)


SetBackgroundColour(self, colour)


SetBezelWidth(self, width)

Set the width of the 3D effect



SetDefault(self)


SetForegroundColour(self, colour)


SetInitialSize(self, size=None)

Given the current font and bezel width settings, calculate and set a good size.



SetUseFocusIndicator(self, flag)

Specifiy if a focus indicator (dotted line) should be used



ShouldInheritColours(self)

Overridden base class virtual. Buttons usually don’t inherit the parent’s colours.