Package wx :: Package lib :: Module platebtn :: Class PlateButton

[frames | no frames]

## Type PlateButton

    object --+
             |
        Object --+
                 |
        EvtHandler --+
                     |
                Window --+
                         |
                   Control --+
                             |
                     PyControl --+
                                 |
                                PlateButton

PlateButton is a custom type of flat button with support for displaying bitmaps and having an attached dropdown menu.

Method Summary
| ``__init__`(self, parent, id_, label, bmp, pos, size, style, name)` Create a PlateButton @keyword label: Buttons label text @keyword bmp: Buttons bitmap @keyword style: Button style
| ``AcceptsFocus`(self)` Can this window have the focus?
| ``Disable`(self)` Disable the control
| ``DoGetBestSize`(self)` Calculate the best size of the button @return: wx.Size
| ``Enable`(self, enable)` Enable/Disable the control
| ``GetBackgroundBrush`(self, dc)` Get the brush for drawing the background of the button @return: wx.Brush @note: used internally when on gtk
| ``GetBitmapDisabled`(self)` Get the bitmap of the disable state @return: wx.Bitmap or None
| ``GetBitmapFocus`(self)` Get the label bitmap @return: wx.Bitmap or None
| ``GetBitmapHover`(self)` Get the label bitmap @return: wx.Bitmap or None
| ``GetBitmapLabel`(self)` Get the label bitmap @return: wx.Bitmap or None
String | ``GetLabelText`(self)` Generic way of getting a label from any window, for identification purposes.
| ``GetMenu`(self)` Return the menu associated with this button or None if no menu is associated with it.
| ``HasTransparentBackground`(self)` Override setting of background fill
| ``OnErase`(self, evt)` Trap the erase event to keep the background transparent on windows.
| ``OnFocus`(self, evt)` Set the visual focus state if need be
| ``OnKeyUp`(self, evt)` Execute a single button press action when the Return key is pressed and this control has the focus.
| ``OnKillFocus`(self, evt)` Set the visual state back to normal when focus is lost unless the control is currently in a pressed state.
| ``OnLeftDown`(self, evt)` Sets the pressed state and depending on the click position will show the popup menu if one has been set.
| ``OnLeftUp`(self, evt)` Post a button event if the control was previously in a pressed state.
| ``OnMenuClose`(self, evt)` Refresh the control to a proper state after the menu has been dismissed.
| ``SetBitmap`(self, bmp)` Set the bitmap displayed in the button @param bmp: wx.Bitmap
| ``SetBitmapDisabled`(self, bmp)` Set the bitmap for the disabled state @param bmp: wx.Bitmap
| ``SetBitmapFocus`(self, bmp)` Set the bitmap displayed in the button @param bmp: wx.Bitmap
| ``SetBitmapHover`(self, bmp)` Set the bitmap displayed in the button @param bmp: wx.Bitmap
| ``SetBitmapLabel`(self, bmp)` Set the bitmap displayed in the button @param bmp: wx.Bitmap
| ``SetBitmapSelected`(self, bmp)` Set the bitmap displayed in the button @param bmp: wx.Bitmap
| ``SetFocus`(self)` Set this control to have the focus
| ``SetFont`(self, font)` Adjust size of control when font changes
| ``SetLabel`(self, label)` Set the label of the button @param label: lable string
| ``SetLabelColor`(self, normal, hlight)` Set the color of the label.
| ``SetMenu`(self, menu)` Set the menu that can be shown when clicking on the drop arrow of the button.
| ``SetPressColor`(self, color)` Set the color used for highlighting the pressed state @param color: wx.Color @note: also resets all text colours as necessary
| ``SetState`(self, state)` Manually set the state of the button @param state: one of the PLATE_* values @note: the state may be altered by mouse actions
| ``SetWindowStyle`(self, style)` Sets the window style bytes, the updates take place immediately no need to call refresh afterwards.
| ``SetWindowVariant`(self, variant)` Set the variant/font size of this control
| ``ShouldInheritColours`(self)` Overridden base class virtual.
| ``ShowMenu`(self)` Show the dropdown menu if one is associated with this control
| ``ToggleState`(self)` Toggle button state

Property Summary
| `BitmapDisabled`: Property for accessing the bitmap for the disabled state
| `BitmapFocus`: Property for accessing the default bitmap
| `BitmapHover`: Property for accessing the default bitmap
| `BitmapLabel`: Property for accessing the default bitmap
| `BitmapSelected`: Property for accessing the default bitmap
| `LabelText`: Property for getting the label of the button

Instance Method Details

### __init__(self, parent, id_=-1, label='', bmp=None, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=1, name=u'button')
(Constructor)

Create a PlateButton @keyword label: Buttons label text @keyword bmp: Buttons bitmap @keyword style: Button style

  Overrides:
    `wx.PyControl.__init__`

### AcceptsFocus(self)

Can this window have the focus?

  Overrides:
    `wx.Window.AcceptsFocus`

### Disable(self)

Disable the control

  Overrides:
    `wx.Window.Disable`

### DoGetBestSize(self)

Calculate the best size of the button @return: wx.Size

  Overrides:
    `wx.PyControl.DoGetBestSize`

### Enable(self, enable=True)

Enable/Disable the control

  Overrides:
    `wx.Window.Enable`

### GetBackgroundBrush(self, dc)

Get the brush for drawing the background of the button @return: wx.Brush @note: used internally when on gtk

### GetBitmapDisabled(self)

Get the bitmap of the disable state @return: wx.Bitmap or None

### GetBitmapFocus(self)

Get the label bitmap @return: wx.Bitmap or None

### GetBitmapHover(self)

Get the label bitmap @return: wx.Bitmap or None

### GetBitmapLabel(self)

Get the label bitmap @return: wx.Bitmap or None

### GetLabelText(self)

Generic way of getting a label from any window, for identification purposes. The interpretation of this function differs from class to class. For frames and dialogs, the value returned is the title. For buttons or static text controls, it is the button text. This function can be useful for meta-programs such as testing tools or special-needs access programs)which need to identify windows by name.

  Returns:
    String

### GetMenu(self)

Return the menu associated with this button or None if no menu is associated with it.

### HasTransparentBackground(self)

Override setting of background fill

  Overrides:
    `wx.Window.HasTransparentBackground`

### OnErase(self, evt)

Trap the erase event to keep the background transparent on windows. @param evt: wx.EVT_ERASE_BACKGROUND

### OnFocus(self, evt)

Set the visual focus state if need be

### OnKeyUp(self, evt)

Execute a single button press action when the Return key is pressed and this control has the focus. @param evt: wx.EVT_KEY_UP

### OnKillFocus(self, evt)

Set the visual state back to normal when focus is lost unless the control is currently in a pressed state.

### OnLeftDown(self, evt)

Sets the pressed state and depending on the click position will show the popup menu if one has been set.

### OnLeftUp(self, evt)

Post a button event if the control was previously in a pressed state. @param evt: wx.MouseEvent

### OnMenuClose(self, evt)

Refresh the control to a proper state after the menu has been dismissed. @param evt: wx.EVT_MENU_CLOSE

### SetBitmap(self, bmp)

Set the bitmap displayed in the button @param bmp: wx.Bitmap

### SetBitmapDisabled(self, bmp)

Set the bitmap for the disabled state @param bmp: wx.Bitmap

### SetBitmapFocus(self, bmp)

Set the bitmap displayed in the button @param bmp: wx.Bitmap

### SetBitmapHover(self, bmp)

Set the bitmap displayed in the button @param bmp: wx.Bitmap

### SetBitmapLabel(self, bmp)

Set the bitmap displayed in the button @param bmp: wx.Bitmap

### SetBitmapSelected(self, bmp)

Set the bitmap displayed in the button @param bmp: wx.Bitmap

### SetFocus(self)

Set this control to have the focus

  Overrides:
    `wx.Window.SetFocus`

### SetFont(self, font)

Adjust size of control when font changes

  Overrides:
    `wx.Window.SetFont`

### SetLabel(self, label)

Set the label of the button @param label: lable string

  Overrides:
    `wx.Window.SetLabel`

### SetLabelColor(self, normal, hlight=wx.Colour(-1, -1, -1, 255))

Set the color of the label. The optimal label color is usually automatically selected depending on the button color. In some cases the colors that are choosen may not be optimal.

The normal state must be specified, if the other two params are left Null they will be automatically guessed based on the normal color. To prevent this automatic color choices from happening either specify a color or None for the other params.

@param normal: Label color for normal state @keyword hlight: Color for when mouse is hovering over

### SetMenu(self, menu)

Set the menu that can be shown when clicking on the drop arrow of the button. @param menu: wxMenu to use as a PopupMenu @note: Arrow is not drawn unless a menu is set

### SetPressColor(self, color)

Set the color used for highlighting the pressed state @param color: wx.Color @note: also resets all text colours as necessary

### SetState(self, state)

Manually set the state of the button @param state: one of the PLATE_* values @note: the state may be altered by mouse actions

### SetWindowStyle(self, style)

Sets the window style bytes, the updates take place immediately no need to call refresh afterwards. @param style: bitmask of PB_STYLE_* values

  Overrides:
    `wx.Window.SetWindowStyleFlag`

### SetWindowVariant(self, variant)

Set the variant/font size of this control

  Overrides:
    `wx.Window.SetWindowVariant`

### ShouldInheritColours(self)

Overridden base class virtual. If the parent has non-default colours then we want this control to inherit them.

  Overrides:
    `wx.Window.ShouldInheritColours`

### ShowMenu(self)

Show the dropdown menu if one is associated with this control

### ToggleState(self)

Toggle button state

Property Details

### BitmapDisabled

Property for accessing the bitmap for the disabled state

### BitmapFocus

Property for accessing the default bitmap

### BitmapHover

Property for accessing the default bitmap

### BitmapLabel

Property for accessing the default bitmap

### BitmapSelected

Property for accessing the default bitmap

### LabelText

Property for getting the label of the button

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:54:05 2009 | http://epydoc.sf.net