]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/tests/test5.py
wxPython 2.0b9, second phase (gtk)
[wxWidgets.git] / utils / wxPython / tests / test5.py
1 #!/bin/env python
2 #----------------------------------------------------------------------------
3 # Name: test5.py
4 # Purpose: Testing wxTaskBarIcon for win32 systems
5 #
6 # Author: Robin Dunn
7 #
8 # Created: 17-Nov-1998
9 # RCS-ID: $Id$
10 # Copyright: (c) 1998 by Total Control Software
11 # Licence: wxWindows license
12 #----------------------------------------------------------------------------
13
14
15 from wxPython.wx import *
16
17
18 #---------------------------------------------------------------------------
19
20 class MyDialog(wxDialog):
21 def __init__(self):
22 wxDialog.__init__(self, NULL, -1, "wxTaskBarIcon Test",
23 wxPoint(-1,-1), wxSize(380,250),
24 wxDIALOG_MODELESS|wxDEFAULT_DIALOG_STYLE)
25
26 # build the contents of the Dialog
27 wxStaticText(self, -1,
28 "Press OK to hide me, Exit to quit.",
29 wxPoint(10, 20))
30 wxStaticText(self, -1,
31 "Double-click on the taskbar icon to show me again.",
32 wxPoint(10, 40))
33
34 okButton = wxButton(self, wxID_OK, "OK", wxPoint(100, 180), wxSize(80, 25))
35 exitButton = wxButton(self, wxID_EXIT, "Exit", wxPoint(185, 180), wxSize(80, 25))
36 okButton.SetDefault()
37 self.Centre(wxBOTH)
38
39 EVT_BUTTON(self, wxID_OK, self.OnOK)
40 EVT_BUTTON(self, wxID_EXIT, self.OnExit)
41
42
43 # make the TaskBar icon
44 self.tbIcon = wxTaskBarIcon()
45 icon = wxIcon('bitmaps/smiles.ico', wxBITMAP_TYPE_ICO)
46 self.tbIcon.SetIcon(icon, "Test ToolTip")
47 EVT_TASKBAR_LEFT_DCLICK(self.tbIcon, self.OnTaskBarActivate)
48
49
50
51 def OnTaskBarActivate(self, event):
52 self.Show(true)
53
54 def OnOK(self, event):
55 self.Show(false)
56
57 def OnExit(self, event):
58 self.Close(true)
59
60 def OnCloseWindow(self, event):
61 self.Destroy()
62 del self.tbIcon # ensure the tbIcon is cleaned up...
63
64
65
66 #---------------------------------------------------------------------------
67
68 class MyApp(wxApp):
69 def OnInit(self):
70 self.dlg = MyDialog()
71 self.dlg.Show(true)
72 self.SetTopWindow(self.dlg)
73 return true
74
75 #---------------------------------------------------------------------------
76
77
78 def main():
79 app = MyApp(0)
80 app.MainLoop()
81
82
83 def t():
84 import pdb
85 pdb.run('main()')
86
87 if __name__ == '__main__':
88 main()
89
90
91 #----------------------------------------------------------------------------
92 #
93 # $Log$
94 # Revision 1.2 1998/12/15 20:44:36 RD
95 # Changed the import semantics from "from wxPython import *" to "from
96 # wxPython.wx import *" This is for people who are worried about
97 # namespace pollution, they can use "from wxPython import wx" and then
98 # prefix all the wxPython identifiers with "wx."
99 #
100 # Added wxTaskbarIcon for wxMSW.
101 #
102 # Made the events work for wxGrid.
103 #
104 # Added wxConfig.
105 #
106 # Added wxMiniFrame for wxGTK, (untested.)
107 #
108 # Changed many of the args and return values that were pointers to gdi
109 # objects to references to reflect changes in the wxWindows API.
110 #
111 # Other assorted fixes and additions.
112 #
113 # Revision 1.1 1998/11/25 08:47:12 RD
114 #
115 # Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
116 # Added events for wxGrid
117 # Other various fixes and additions
118 #
119 #