AGW Logo

agw_title ToasterBoxWindow

This class does all the job, by handling background images, text properties and panel adding. Depending on the style you choose, ToasterBoxWindow will behave differently in order to handle widgets inside it.

hierarchy Inheritance Diagram

Inheritance diagram for: ToasterBoxWindow

Inheritance diagram of ToasterBoxWindow


method_summary Methods Summary

__init__Default class constructor.
AddPanelAdds a panel to the ToasterBox.
AlphaCycleHandles the wx.EVT_TIMER event for ToasterBoxWindow.
DrawTextDraws the text label for a ToasterBox with TB_SIMPLE style set.
GetPopupTextReturns the ToasterBox text.
MakeWindowTransparentMakes the ToasterBoxWindow window transparent.
NotifyTimerHides gradually the ToasterBoxWindow.
OnCloseHandles the wx.EVT_CLOSE event for ToasterBoxWindow.
OnMouseDownHandles the wx.EVT_LEFT_DOWN event for ToasterBoxWindow.
OnPaintHandles the wx.EVT_PAINT event for ToasterBoxWindow.
OnScrollTimerHandles the wx.EVT_TIMER event for ToasterBoxWindow scrolling up/down.
PlayCreates the ToasterBoxWindow, that does all the job.
ScrollDownScrolls the ToasterBox down, which means gradually hiding it.
ScrollUpScrolls the ToasterBox up, which means gradually showing it.
SetPopupBackgroundColourSets the ToasterBox background colour.
SetPopupBitmapSets the ToasterBox background image.
SetPopupPauseTimeSets the time after which the ToasterBox is destroyed (linger).
SetPopupPositionSets the ToasterBox position on screen.
SetPopupPositionByIntSets the ToasterBox position on screen, at one of the screen corners.
SetPopupScrollSpeedSets the ToasterBox scroll speed.
SetPopupSizeSets the ToasterBox size.
SetPopupTextSets the ToasterBox text label.
SetPopupTextColourSets the ToasterBox foreground colour.
SetPopupTextFontSets the ToasterBox text font.
SetUseFocusIf focus is True, Instructs ToasterBoxWindow to steal the focus from the
SetupPositionsSets up the position, size and scrolling step for ToasterBoxWindow.
TearDownScrolls the ToasterBox down, which means gradually hiding it.
TearUpScrolls the ToasterBox up, which means gradually showing it.
_getTextCoordsDraw the user specified text.

API Class API

class ToasterBoxWindow(wx.Frame)[source]

This class does all the job, by handling background images, text properties and panel adding. Depending on the style you choose, ToasterBoxWindow will behave differently in order to handle widgets inside it.



__init__(parent, parent2, tbstyle, windowstyle, closingstyle, scrollType=TB_SCR_TYPE_DU)[source]

Default class constructor. Used internally. Do not call directly this class in your application!

Parameters:
  • parent – the window parent;
  • parent2 – the ToasterBox calling this window;
  • tbstyle – the ToasterBoxWindow main style. Can be one of the following bits:


    ToasterBox Style Value Description
    TB_SIMPLE 0x1 A simple ToasterBox, with background image and text customization can be created
    TB_COMPLEX 0x2 ToasterBoxes with different degree of complexity can be created. You can add as many controls as you want, provided that you call the AddPanel method and pass to it a dummy frame and a wx.Panel.
  • windowstyle – this parameter influences the visual appearance of ToasterBoxWindow, and can be one of the following styles:


    Window Style Hex Value Description
    TB_DEFAULT_STYLE 0x2008002 Default window style for ToasterBox, with no caption nor close box.
    TB_CAPTION 0x22009806 ToasterBox will have a caption, with the possibility to set a title for the ToasterBox frame, and a close box.
  • closingstyle – the closing style for ToasterBoxWindow. Can be one of the following bits:


    Closing Styles Hex Value Description
    TB_ONTIME 0x1 ToasterBox will close after a specified amount of time.
    TB_ONCLICK 0x2 ToasterBox can be closed by clicking anywhere on the ToasterBox frame.
  • scrollType – the scrolling direction for ToasterBoxWindow. Can be one of the following bits:


    Scroll Styles Hex Value Description
    TB_SCR_TYPE_UD 0x1 ToasterBox will scroll from up to down
    TB_SCR_TYPE_DU 0x2 ToasterBox will scroll from down to up
    TB_SCR_TYPE_FADE 0x4 ToasterBox will fade in/out (without scrolling).


AddPanel(panel)[source]

Adds a panel to the ToasterBox.

Parameters:panel – an instance of wx.Window.

Note

Use this method only for a ToasterBox created with the TB_COMPLEX style.



AlphaCycle(event)[source]

Handles the wx.EVT_TIMER event for ToasterBoxWindow.

Parameters:event – a wx.TimerEvent event to be processed.


DrawText(dc=None)[source]

Draws the text label for a ToasterBox with TB_SIMPLE style set.

Parameters:dc – an instance of wx.DC. If defaulted to None, a wx.ClientDC will be created on the fly.


GetPopupText()[source]

Returns the ToasterBox text.

Note

Use this method only for a ToasterBox created with the TB_SIMPLE style.



MakeWindowTransparent(amount)[source]

Makes the ToasterBoxWindow window transparent.

Parameters:amount – the alpha channel value.


NotifyTimer(event)[source]

Hides gradually the ToasterBoxWindow.



OnClose(event)[source]

Handles the wx.EVT_CLOSE event for ToasterBoxWindow.

Parameters:event – a wx.CloseEvent event to be processed.


OnMouseDown(event)[source]

Handles the wx.EVT_LEFT_DOWN event for ToasterBoxWindow.

Parameters:event – a wx.MouseEvent event to be processed.


OnPaint(event)[source]

Handles the wx.EVT_PAINT event for ToasterBoxWindow.

Parameters:event – a wx.PaintEvent event to be processed.

Note

This event is handled and processed only if the style TB_SIMPLE is given to ToasterBox.



OnScrollTimer(event)[source]

Handles the wx.EVT_TIMER event for ToasterBoxWindow scrolling up/down.

Parameters:event – a wx.TimerEvent event to be processed.



Play()[source]

Creates the ToasterBoxWindow, that does all the job.



ScrollDown()[source]

Scrolls the ToasterBox down, which means gradually hiding it.



ScrollUp()[source]

Scrolls the ToasterBox up, which means gradually showing it.



SetPopupBackgroundColour(colour)[source]

Sets the ToasterBox background colour.

Parameters:colour – a valid wx.Colour object. If defaulted to None, then the background colour will be white.

Note

Use this method only for a ToasterBox created with the TB_SIMPLE style.



SetPopupBitmap(bitmap=None)[source]

Sets the ToasterBox background image.

Parameters:bitmap – a valid wx.Bitmap object. If defaulted to None, then no background bitmap is used.

Note

Use this method only for a ToasterBox created with the TB_SIMPLE style.



SetPopupPauseTime(pausetime)[source]

Sets the time after which the ToasterBox is destroyed (linger).

Parameters:pausetime – the delay after which the control is destroyed, in seconds.


SetPopupPosition(pos)[source]

Sets the ToasterBox position on screen.

Parameters:pos – the widget position, an instance of wx.Point.


SetPopupPositionByInt(pos)[source]

Sets the ToasterBox position on screen, at one of the screen corners.

Parameters:pos – an integer specifying the screen corner, namely:


Corner Number Position
0 Top left screen corner
1 Top right screen corner
2 Bottom left screen corner
3 Bottom right screen corner


SetPopupScrollSpeed(speed)[source]

Sets the ToasterBox scroll speed.

Parameters:speed – it is the pause time (in milliseconds) for every step in the ScrollUp method.


SetPopupSize(size)[source]

Sets the ToasterBox size.

Parameters:size – the new control size, an instance of wx.Size.


SetPopupText(text)[source]

Sets the ToasterBox text label.

Parameters:text – the widget label.

Note

Use this method only for a ToasterBox created with the TB_SIMPLE style.



SetPopupTextColour(colour)[source]

Sets the ToasterBox foreground colour.

Parameters:colour – a valid wx.Colour object. If defaulted to None, then the background colour will be black.

Note

Use this method only for a ToasterBox created with the TB_SIMPLE style.



SetPopupTextFont(font)[source]

Sets the ToasterBox text font.

Parameters:colour – a valid wx.Colour object. If defaulted to None, then a simple generic font will be generated.

Note

Use this method only for a ToasterBox created with the TB_SIMPLE style.



SetUseFocus(focus, originalfocus)[source]

If focus is True, Instructs ToasterBoxWindow to steal the focus from the parent application, otherwise it returns the focus to the original owner.

Parameters:
  • focusTrue to set the focus on ToasterBoxWindow, False to return it to the original owner;
  • originalfocus – an instance of wx.Window, representing a pointer to the window which originally had the focus



SetupPositions()[source]

Sets up the position, size and scrolling step for ToasterBoxWindow.



TearDown()[source]

Scrolls the ToasterBox down, which means gradually hiding it.



TearUp()[source]

Scrolls the ToasterBox up, which means gradually showing it.

Tree

Table Of Contents

Previous topic

ToasterBox

Next topic

SVN Revision 68342 For toasterbox