phoenix_title wx.lib.agw.aui.aui_utilities

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.

function_summary Functions Summary

BitmapFromBits

A utility function that creates a masked bitmap from raw bits (XBM format).

BlendColour

Blends the two colour component fg and bg into one colour component, adding

ChopText

Chops the input text if its size does not fit in max_size, by cutting the

Clip

Clips the value in a based on the extremes b and c.

CopyAttributes

Copies pens, brushes, colours and fonts from the old tab art to the new one.

DarkenBitmap

Darkens the input bitmap on wxMAC using the input colour.

DrawGradientRectangle

Draws a gradient-shaded rectangle.

DrawMACCloseButton

Draws the wxMAC tab close button using GraphicsContext.

FindFocusDescendant

Find a window with the focus, that is also a descendant of the given window.

GetBaseColour

Returns the face shading colour on push buttons/backgrounds,

GetDockingImage

Returns the correct name of the docking bitmap depending on the input parameters.

GetLabelSize

Returns the AuiToolBar item label size.

GetSlidingPoints

Returns the point at which the sliding in and out of a minimized pane begins.

IndentPressedBitmap

Indents the input rectangle rect based on the value of button_state.

LightColour

Brighten input colour by percent.

LightContrastColour

Creates a new, lighter colour based on the input colour c.

MakeDisabledBitmap

Convert the given image (in place) to a grayed-out version, appropriate for a ‘disabled’ appearance.

PaneCreateStippleBitmap

Creates a stipple bitmap to be used in a wx.Brush.

RescaleScreenShot

Rescales a bitmap to be thumbnail_size pixels wide (or tall) at maximum.

StepColour

Darken/lighten the input colour c.

TakeScreenShot

Takes a screenshot of the screen at given position and size (rect).


class_summary Classes Summary

TabDragImage

This class handles the creation of a custom image in case of drag and drop of a notebook tab.


Functions



BitmapFromBits(bits, w, h, colour)

A utility function that creates a masked bitmap from raw bits (XBM format).

Parameters:
  • 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.

Parameters:
  • fg (wx.Colour) – the first colour component;

  • bg (wx.Colour) – the second colour component;

  • alpha (integer) – an optional transparency value.



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.

Parameters:
  • 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.

Parameters:
  • 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.

Parameters:


DarkenBitmap(bmp, caption_colour, new_colour)

Darkens the input bitmap on wxMAC using the input colour.

Parameters:
  • bmp (wx.Bitmap) – the bitmap to be manipulated;

  • caption_colour (wx.Colour) – the colour of the pane caption;

  • new_colour (wx.Colour) – the colour used to darken the bitmap.



DrawGradientRectangle(dc, rect, start_colour, end_colour, direction, offset=0, length=0)

Draws a gradient-shaded rectangle.

Parameters:
  • dc – a wx.DC device context;

  • rect (wx.Rect) – the rectangle in which to draw the gradient;

  • start_colour (wx.Colour) – the first colour of the gradient;

  • end_colour (wx.Colour) – the second colour of the gradient;

  • direction (integer) – the gradient direction (horizontal or vertical).



DrawMACCloseButton(colour, backColour=None)

Draws the wxMAC tab close button using GraphicsContext.

Parameters:
  • colour (wx.Colour) – the colour to use to draw the circle;

  • backColour (wx.Colour) – the optional background colour for the circle.



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.

Parameters:

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.

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.

Parameters:
  • 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.

Parameters:
  • 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.

Parameters:
  • rect (wx.Rect) – the button bitmap rectangle;

  • button_state (integer) – the button state.



LightColour(colour, percent)

Brighten input colour by percent.

Parameters:
  • 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.

Parameters:

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.

Parameters:

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.

Parameters:
  • 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.

Parameters:
  • c (wx.Colour) – a colour to darken/lighten;

  • ialpha (integer) – a transparency value.



TakeScreenShot(rect)

Takes a screenshot of the screen at given position and size (rect).

Parameters:

rect (wx.Rect) – the screen rectangle for which we want to take a screenshot.