File: wx.lib.agw.toasterbox.ToasterBox.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (361 lines) | stat: -rw-r--r-- 15,393 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.toasterbox

.. highlight:: python



.. _wx.lib.agw.toasterbox.ToasterBox:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.toasterbox.ToasterBox**
==========================================================================================================================================

ToasterBox is a cross-platform widget to make the creation of MSN style "toaster"
popups easier.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>ToasterBox</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.toasterbox.ToasterBox_inheritance.png" alt="Inheritance diagram of ToasterBox" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="64,83,175,112"/> <area shape="rect" id="node4" href="wx.Timer.html" title="wx.Timer" alt="" coords="81,160,159,189"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="21,5,103,35"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="128,5,229,35"/> <area shape="rect" id="node5" href="wx.lib.agw.toasterbox.ToasterBox.html" title="wx.lib.agw.toasterbox.ToasterBox" alt="" coords="5,237,235,267"/> </map> 
   </p>

|


|appearance| Control Appearance
===============================

|

.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.toasterbox.toasterbox.png
   :alt: wxMSW
   :figclass: floatleft

   **wxMSW**


.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
   :alt: wxMAC
   :figclass: floatright

   **wxMAC**


.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
   :alt: wxGTK
   :figclass: floatcenter

   **wxGTK**


|




|super_classes| Known Superclasses
==================================

:class:`wx.Timer`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.toasterbox.ToasterBox.__init__`                               Default class constructor.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.AddPanel`                               Adds a panel to the :class:`ToasterBox`.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.CenterOnParent`                         Centres the window on its parent (if any). If the :class:`ToasterBox` parent is ``None``,
:meth:`~wx.lib.agw.toasterbox.ToasterBox.CenterOnScreen`                         Centres the :class:`ToasterBox` on screen.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.CleanList`                              Cleans the window list, erasing the stack of :class:`ToasterBox` objects.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.GetToasterBoxWindow`                    Returns the :class:`ToasterBox` frame.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.GetUseFocus`                            Returns whether :class:`ToasterBox` will steal the focus from the parent application.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.MoveAbove`                              If a :class:`ToasterBox` already exists, move the new one above the existing one.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.Notify`                                 It's time to hide a :class:`ToasterBox`.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.OnMoveTimer`                            Handles the ``wx.EVT_TIMER`` event for :class:`ToasterBox`, moving the new window
:meth:`~wx.lib.agw.toasterbox.ToasterBox.Play`                                   Creates the :class:`ToasterBoxWindow`, that does all the job.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupBackgroundColour`               Sets the :class:`ToasterBox` background colour.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupBitmap`                         Sets the :class:`ToasterBox` background image.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupPauseTime`                      Sets the time after which the :class:`ToasterBox` is destroyed (linger).
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupPosition`                       Sets the :class:`ToasterBox` position on screen.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupPositionByInt`                  Sets the :class:`ToasterBox` position on screen, at one of the screen corners.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupScrollSpeed`                    Sets the :class:`ToasterBox` scroll speed.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupSize`                           Sets the :class:`ToasterBox` size.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupText`                           Sets the :class:`ToasterBox` text label.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupTextColour`                     Sets the :class:`ToasterBox` foreground colour.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupTextFont`                       Sets the :class:`ToasterBox` text font.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetTitle`                               Sets the :class:`ToasterBox` title if it was created with ``TB_CAPTION`` window style.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetUseFocus`                            If `focus` is ``True``, Instructs :class:`ToasterBox` to steal the focus from the
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: ToasterBox(wx.Timer)

   ToasterBox is a cross-platform widget to make the creation of MSN style "toaster"
   popups easier.

   .. method:: __init__(self, parent, tbstyle=TB_SIMPLE, windowstyle=TB_DEFAULT_STYLE, closingstyle=TB_ONTIME, scrollType=TB_SCR_TYPE_DU)

      Default class constructor.
      
      :param `parent`: the window parent;
      :param `tbstyle`: the :class:`ToasterBox` main style. Can be one of the following
       bits:
      
       ====================== ======= ================================
       `ToasterBox` Style      Value  Description
       ====================== ======= ================================
       ``TB_SIMPLE``              0x1 A simple :class:`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 :meth:`~ToasterBox.AddPanel` method and pass to it a dummy frame and a :class:`Panel`.
       ====================== ======= ================================
      
      :param `windowstyle`: this parameter influences the visual appearance of
       :class:`ToasterBox`, and can be one of the following styles:
      
       ====================== ========== ================================
       Window Style           Hex Value  Description
       ====================== ========== ================================
       ``TB_DEFAULT_STYLE``   0x2008002  Default window style for :class:`ToasterBox`, with no caption nor close box.
       ``TB_CAPTION``         0x22009806 :class:`ToasterBox` will have a caption, with the possibility to set a title for the :class:`ToasterBox` frame, and a close box.
       ====================== ========== ================================
      
      :param `closingstyle`: the closing style for :class:`ToasterBox`. Can be one of the
       following bits:
      
       ==================== =========== ==================================================
       Closing Styles       Hex Value   Description
       ==================== =========== ==================================================
       ``TB_ONTIME``                0x1 :class:`ToasterBox` will close after a specified amount of time.
       ``TB_ONCLICK``               0x2 :class:`ToasterBox` can be closed by clicking anywhere on the :class:`ToasterBox` frame.
       ==================== =========== ==================================================
      
      :param `scrollType`: the scrolling direction for :class:`ToasterBox`. Can be one of the
       following bits:
      
       ==================== =========== ==================================================
       Scroll Styles        Hex Value   Description
       ==================== =========== ==================================================
       ``TB_SCR_TYPE_UD``           0x1 :class:`ToasterBox` will scroll from up to down
       ``TB_SCR_TYPE_DU``           0x2 :class:`ToasterBox` will scroll from down to up
       ``TB_SCR_TYPE_FADE``         0x4 :class:`ToasterBox` will fade in/out (without scrolling).
       ==================== =========== ==================================================


   .. method:: AddPanel(self, panel)

      Adds a panel to the :class:`ToasterBox`.
      
      :param `panel`: an instance of :class:`wx.Window`.
      
      :note: Use this method only for a :class:`ToasterBox` created with the ``TB_COMPLEX`` style.


   .. method:: CenterOnParent(self, direction=wx.BOTH)

      Centres the window on its parent (if any). If the :class:`ToasterBox` parent is ``None``,
      it calls :meth:`~ToasterBox.CenterOnScreen`.
      
      :param `direction`: specifies the direction for the centering. May be ``wx.HORIZONTAL``,
       ``wx.VERTICAL`` or ``wx.BOTH``.
      
      :note: This methods provides for a way to center :class:`ToasterBox` over their parents instead of the
       entire screen. If there is no parent, then behaviour is the same as :meth:`~ToasterBox.CenterOnScreen`.
      
      :see: :meth:`~ToasterBox.CenterOnScreen`.


   .. method:: CenterOnScreen(self, direction=wx.BOTH)

      Centres the :class:`ToasterBox` on screen.
      
      :param `direction`: specifies the direction for the centering. May be ``wx.HORIZONTAL``,
       ``wx.VERTICAL`` or ``wx.BOTH``.
      
      :see: :meth:`~ToasterBox.CenterOnParent`.


   .. method:: CleanList(self)

      Cleans the window list, erasing the stack of :class:`ToasterBox` objects. 


   .. method:: GetToasterBoxWindow(self)

      Returns the :class:`ToasterBox` frame. 


   .. method:: GetUseFocus(self)

      Returns whether :class:`ToasterBox` will steal the focus from the parent application. 


   .. method:: MoveAbove(self, tb)

      If a :class:`ToasterBox` already exists, move the new one above the existing one.
      
      :param `tb`: another instance of :class:`ToasterBox`.


   .. method:: Notify(self)

      It's time to hide a :class:`ToasterBox`. 


   .. method:: OnMoveTimer(self, event)

      Handles the ``wx.EVT_TIMER`` event for :class:`ToasterBox`, moving the new window
      on top of the last one created.
      
      :param `event`: a :class:`TimerEvent` event to be processed.


   .. method:: Play(self)

      Creates the :class:`ToasterBoxWindow`, that does all the job. 


   .. method:: SetPopupBackgroundColour(self, colour=None)

      Sets the :class:`ToasterBox` background colour.
      
      :param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, then
       the background colour will be white.
      
      :note: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.


   .. method:: SetPopupBitmap(self, bitmap=None)

      Sets the :class:`ToasterBox` background image.
      
      :param `bitmap`: a valid :class:`wx.Bitmap` object or filename. If defaulted
       to ``None``, then no background bitmap is used.
      
      :note: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.


   .. method:: SetPopupPauseTime(self, pausetime)

      Sets the time after which the :class:`ToasterBox` is destroyed (linger).
      
      :param `pausetime`: the delay after which the control is destroyed, in seconds.


   .. method:: SetPopupPosition(self, pos)

      Sets the :class:`ToasterBox` position on screen.
      
      :param `pos`: the widget position, an instance of :class:`wx.Point`.


   .. method:: SetPopupPositionByInt(self, pos)

      Sets the :class:`ToasterBox` position on screen, at one of the screen corners.
      
      :param `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
       ============= ========================================


   .. method:: SetPopupScrollSpeed(self, speed)

      Sets the :class:`ToasterBox` scroll speed.
      
      :param `speed`: it is the pause time (in milliseconds) for every step in the
       `ScrollUp` method.


   .. method:: SetPopupSize(self, size)

      Sets the :class:`ToasterBox` size.
      
      :param `size`: the new control size, an instance of :class:`wx.Size`.


   .. method:: SetPopupText(self, text)

      Sets the :class:`ToasterBox` text label.
      
      :param `text`: the widget label.
      
      :note: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.


   .. method:: SetPopupTextColour(self, colour=None)

      Sets the :class:`ToasterBox` foreground colour.
      
      :param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, then
       the background colour will be black.
      
      :note: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.


   .. method:: SetPopupTextFont(self, font=None)

      Sets the :class:`ToasterBox` text font.
      
      :param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, then
       a simple generic font will be generated.
      
      :note: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.


   .. method:: SetTitle(self, title)

      Sets the :class:`ToasterBox` title if it was created with ``TB_CAPTION`` window style.
      
      :param `title`: the :class:`ToasterBox` caption title.


   .. method:: SetUseFocus(self, focus)

      If `focus` is ``True``, Instructs :class:`ToasterBox` to steal the focus from the
      parent application, otherwise it returns the focus to the original owner.
      
      :param `focus`: ``True`` to set the focus on :class:`ToasterBox`, ``False`` to
       return it to the original owner.