This module contains some common functions used by lib.agw.aui
to
manipulate colours, bitmaps, text, gradient shadings and custom dragging images
for AuiNotebook
tabs.
A utility function that creates a masked bitmap from raw bits (XBM format). |
|
Blends the two colour component fg and bg into one colour component, adding |
|
Chops the input text if its size does not fit in max_size, by cutting the |
|
Clips the value in a based on the extremes b and c. |
|
Copies pens, brushes, colours and fonts from the old tab art to the new one. |
|
Darkens the input bitmap on wxMAC using the input colour. |
|
Draws a gradient-shaded rectangle. |
|
Draws the wxMAC tab close button using |
|
Find a window with the focus, that is also a descendant of the given window. |
|
Returns the face shading colour on push buttons/backgrounds, |
|
Returns the correct name of the docking bitmap depending on the input parameters. |
|
Returns the |
|
Returns the point at which the sliding in and out of a minimized pane begins. |
|
Indents the input rectangle rect based on the value of button_state. |
|
Brighten input colour by percent. |
|
Creates a new, lighter colour based on the input colour c. |
|
Convert the given image (in place) to a grayed-out version, appropriate for a ‘disabled’ appearance. |
|
Creates a stipple bitmap to be used in a |
|
Rescales a bitmap to be thumbnail_size pixels wide (or tall) at maximum. |
|
Darken/lighten the input colour c. |
|
Takes a screenshot of the screen at given position and size (rect). |
This class handles the creation of a custom image in case of drag and drop of a notebook tab. |
BitmapFromBits
(bits, w, h, colour)¶A utility function that creates a masked bitmap from raw bits (XBM format).
bits (string) – the raw bits of the bitmap;
w (integer) – the bitmap width;
h (integer) – the bitmap height;
colour (wx.Colour) – the colour which will replace all white pixels in the raw bitmap.
BlendColour
(fg, bg, alpha)¶Blends the two colour component fg and bg into one colour component, adding an optional alpha channel.
ChopText
(dc, text, max_size)¶Chops the input text if its size does not fit in max_size, by cutting the text and adding ellipsis at the end.
dc – a wx.DC
device context;
text (string) – the text to chop;
max_size (integer) – the maximum size in which the text should fit.
Clip
(a, b, c)¶Clips the value in a based on the extremes b and c.
a – the value to analyze;
b – a minimum value;
c – a maximum value.
CopyAttributes
(newArt, oldArt)¶Copies pens, brushes, colours and fonts from the old tab art to the new one.
newArt – the new instance of AuiDefaultTabArt
;
oldArt – the old instance of AuiDefaultTabArt
.
DarkenBitmap
(bmp, caption_colour, new_colour)¶Darkens the input bitmap on wxMAC using the input colour.
DrawGradientRectangle
(dc, rect, start_colour, end_colour, direction, offset=0, length=0)¶Draws a gradient-shaded rectangle.
DrawMACCloseButton
(colour, backColour=None)¶Draws the wxMAC tab close button using GraphicsContext
.
FindFocusDescendant
(ancestor)¶Find a window with the focus, that is also a descendant of the given window. This is used to determine the window to initially send commands to.
ancestor (wx.Window) – the window to check for ancestry.
GetBaseColour
()¶Returns the face shading colour on push buttons/backgrounds, mimicking as closely as possible the platform UI colours.
GetDockingImage
(direction, useAero, center)¶Returns the correct name of the docking bitmap depending on the input parameters.
useAero (bool) – whether AuiManager
is using
Aero-style or Whidbey-style docking images or not;
center (bool) – whether we are looking for the center diamond-shaped bitmap or not.
GetLabelSize
(dc, label, vertical)¶Returns the AuiToolBar
item label size.
label (string) – the toolbar tool label;
vertical (bool) – whether the toolbar tool orientation is vertical or not.
GetSlidingPoints
(rect, size, direction)¶Returns the point at which the sliding in and out of a minimized pane begins.
rect (wx.Rect) – the AuiToolBar
tool screen rectangle;
size (wx.Size) – the pane window size;
direction (integer) – the pane docking direction.
IndentPressedBitmap
(rect, button_state)¶Indents the input rectangle rect based on the value of button_state.
rect (wx.Rect) – the button bitmap rectangle;
button_state (integer) – the button state.
LightColour
(colour, percent)¶Brighten input colour by percent.
colour (wx.Colour) – the colour to be brightened;
percent (integer) – brightening percentage.
LightContrastColour
(c)¶Creates a new, lighter colour based on the input colour c.
c (wx.Colour) – the input colour to analyze.
MakeDisabledBitmap
(bitmap)¶Convert the given image (in place) to a grayed-out version, appropriate for a ‘disabled’ appearance.
bitmap (wx.Bitmap) – the bitmap to gray-out.
PaneCreateStippleBitmap
()¶Creates a stipple bitmap to be used in a wx.Brush
.
This is used to draw sash resize hints.
RescaleScreenShot
(bmp, thumbnail_size=200)¶Rescales a bitmap to be thumbnail_size pixels wide (or tall) at maximum.
bmp (wx.Bitmap) – the bitmap to rescale;
thumbnail_size (integer) – the maximum size of every page thumbnail.
StepColour
(c, ialpha)¶Darken/lighten the input colour c.
c (wx.Colour) – a colour to darken/lighten;
ialpha (integer) – a transparency value.