AGW Logo

agw_title BPArt

BPArt is an art provider class which does all of the drawing for ButtonPanel. This allows the library caller to customize the BPArt or to completely replace all drawing with custom BPArts.

hierarchy Inheritance Diagram

Inheritance diagram for: BPArt

Inheritance diagram of BPArt


method_summary Methods Summary

__init__Default class constructor.
DrawButtonDraws a button in ButtonPanel, together with its text (if any).
DrawButtonPanelPaint the ButtonPanel‘s background.
DrawCaptionDraws the main caption text in ButtonPanel.
DrawLabelDraws the label for a button.
DrawSeparatorDraws a separator in ButtonPanel.
FillGradientColourGradient fill from colour 1 to colour 2 with top to bottom or left to right.
GetColorReturns the option value for the specified colour id.
GetColourReturns the option value for the specified colour id.
GetFontReturns the option value for the specified font id.
GetGradientTypeReturns the gradient type for BPArt drawings.
GetMetricReturns the option value for the specified size id.
SetColorSets the option value for the specified colour id.
SetColourSets the option value for the specified colour id.
SetFontSets the option value for the specified font id.
SetGradientTypeSets the gradient type for BPArt drawings.
SetMetricSets the option value for the specified size id.

API Class API

class BPArt(object)[source]

BPArt is an art provider class which does all of the drawing for ButtonPanel. This allows the library caller to customize the BPArt or to completely replace all drawing with custom BPArts.



__init__(parentStyle)[source]

Default class constructor.

Parameters:parentStyle (integer) – the window style for ButtonPanel.


DrawButton(dc, rect, buttonBitmap, isVertical, buttonStatus, isToggled, textAlignment, text='')[source]

Draws a button in ButtonPanel, together with its text (if any).

Parameters:
  • dc – an instance of wx.DC;
  • rect (wx.Rect) – the button client rectangle;
  • buttonBitmap (wx.Bitmap) – the bitmap associated with the button;
  • isVertical (bool) – True if ButtonPanel is in vertical orientation, False otherwise;
  • buttonStatus (string) – one of “Normal”, “Toggled”, “Pressed”, “Disabled” or “Hover”;
  • isToggled (bool) – whether the button is toggled or not;
  • textAlignment (integer) – the text alignment inside the button;
  • text (string) – the button label.


DrawButtonPanel(dc, rect, style)[source]

Paint the ButtonPanel‘s background.

Parameters:


DrawCaption(dc, rect, captionText)[source]

Draws the main caption text in ButtonPanel.

Parameters:
  • dc – an instance of wx.DC;

  • rect (wx.Rect) – the main caption text rectangle;
  • captionText (string) – the caption text string.


DrawLabel(dc, text, isEnabled, xpos, ypos)[source]

Draws the label for a button.

Parameters:
  • dc – an instance of wx.DC;

  • text (string) – the button label;
  • isEnabled (bool) – True if the button is enabled, False otherwise;
  • xpos (integer) – the text x position inside the button;
  • ypos (integer) – the text y position inside the button.


DrawSeparator(dc, rect, isVertical)[source]

Draws a separator in ButtonPanel.

Parameters:
  • dc – an instance of wx.DC;

  • rect (wx.Rect) – the separator client rectangle;
  • isVertical (bool) – True if ButtonPanel is in vertical orientation, False otherwise.


FillGradientColour(dc, rect)[source]

Gradient fill from colour 1 to colour 2 with top to bottom or left to right.

Parameters:
  • dc – an instance of wx.DC;

  • rect (wx.Rect) – the ButtonPanel client rectangle.


GetColor(id)

Returns the option value for the specified colour id.

Parameters:internal`id` – the identification bit for the colour value. This can be one of the following bits:


wx.Rect parameter settings
Colour Id Value Description
BP_BACKGROUND_COLOUR 0 Background brush colour when no gradient shading exists
BP_GRADIENT_COLOUR_FROM 1 Starting gradient colour, used only when BP_USE_GRADIENT style is applied
BP_GRADIENT_COLOUR_TO 2 Ending gradient colour, used only when BP_USE_GRADIENT style is applied
BP_BORDER_COLOUR 3 Pen colour to paint the border of ButtonPanel
BP_TEXT_COLOUR 4 Main ButtonPanel caption colour
BP_BUTTONTEXT_COLOUR 5 Text colour for buttons with text
BP_BUTTONTEXT_INACTIVE_COLOUR 6 Text colour for inactive buttons with text
BP_SELECTION_BRUSH_COLOUR 7 Brush colour to be used when hovering or selecting a button
BP_SELECTION_PEN_COLOUR 8 Pen colour to be used when hovering or selecting a button
BP_SEPARATOR_COLOUR 9 Pen colour used to paint the separators
Returns:An instance of wx.Colour for the input id.
Raise :Exception if the id is not recognized.


GetColour(id)[source]

Returns the option value for the specified colour id.

Parameters:internal`id` – the identification bit for the colour value. This can be one of the following bits:


Colour Id Value Description
BP_BACKGROUND_COLOUR 0 Background brush colour when no gradient shading exists
BP_GRADIENT_COLOUR_FROM 1 Starting gradient colour, used only when BP_USE_GRADIENT style is applied
BP_GRADIENT_COLOUR_TO 2 Ending gradient colour, used only when BP_USE_GRADIENT style is applied
BP_BORDER_COLOUR 3 Pen colour to paint the border of ButtonPanel
BP_TEXT_COLOUR 4 Main ButtonPanel caption colour
BP_BUTTONTEXT_COLOUR 5 Text colour for buttons with text
BP_BUTTONTEXT_INACTIVE_COLOUR 6 Text colour for inactive buttons with text
BP_SELECTION_BRUSH_COLOUR 7 Brush colour to be used when hovering or selecting a button
BP_SELECTION_PEN_COLOUR 8 Pen colour to be used when hovering or selecting a button
BP_SEPARATOR_COLOUR 9 Pen colour used to paint the separators
Returns:An instance of wx.Colour for the input id.
Raise :Exception if the id is not recognized.


GetFont(id)[source]

Returns the option value for the specified font id.

Parameters:id (integer) – the identification bit for the font value. This can be one of the following bits:


integer parameter settings
Size Id Value Description
BP_TEXT_FONT 10 Font of the ButtonPanel main caption
BP_BUTTONTEXT_FONT 11 Text font for the buttons with text
Returns:An instance of wx.Font for the input id.
Raise :Exception if the id is not recognized.


GetGradientType()[source]

Returns the gradient type for BPArt drawings.

Returns:An integer representing the gradient type.

See also

SetGradientType for a list of possible gradient types.



GetMetric(id)[source]

Returns the option value for the specified size id.

Parameters:id (integer) – the identification bit for the size value. This can be one of the following bits:


integer parameter settings
Size Id Value Description
BP_SEPARATOR_SIZE 14 Separator size. Note: This is not the line width, but the sum of the space before and after the separator line plus the width of the line
BP_MARGINS_SIZE 15 Size of the left/right margins in ButtonPanel (top/bottom for vertically aligned ButtonPanel)
BP_BORDER_SIZE 16 Size of the border
BP_PADDING_SIZE 17 Inter-tool separator size
Returns:An integer representing the option value for the input id.
Raise :Exception if the id is not recognized.


SetColor(id, colour)

Sets the option value for the specified colour id.

Parameters:
  • id (integer) – the identification bit for the colour value;
  • colour – the new value for the colour (a valid wx.Colour instance).

Raise :

Exception if the id is not recognized.

See also

GetColour for a list of meaningful colour ids.



SetColour(id, colour)[source]

Sets the option value for the specified colour id.

Parameters:
  • id (integer) – the identification bit for the colour value;
  • colour – the new value for the colour (a valid wx.Colour instance).

Raise :

Exception if the id is not recognized.

See also

GetColour for a list of meaningful colour ids.



SetFont(id, font)[source]

Sets the option value for the specified font id.

Parameters:
  • id (integer) – the identification bit for the font value;
  • colour – the new value for the font (a valid wx.Font instance).

Raise :

Exception if the id is not recognized.

See also

GetFont for a list of meaningful font ids.



SetGradientType(gradient)[source]

Sets the gradient type for BPArt drawings.

Parameters:gradient (integer) – can be one of the following bits:


integer parameter settings
Gradient Type Value Description
BP_GRADIENT_NONE 0 No gradient shading should be used to paint the background
BP_GRADIENT_VERTICAL 1 Vertical gradient shading should be used to paint the background
BP_GRADIENT_HORIZONTAL 2 Horizontal gradient shading should be used to paint the background


SetMetric(id, new_val)[source]

Sets the option value for the specified size id.

Parameters:
  • id (integer) – the identification bit for the size value;
  • input`new_val` – the new value for the size.
Raise :

Exception if the id is not recognized.

See also

GetMetric for a list of meaningful size ids.

Tree

Table Of Contents

Previous topic

buttonpanel

Next topic

BoxSizer