root/trunk/RBSkinning/RBSkinning/wxPythonSkin/frame_mover.py

Revision 488, 2.6 kB (checked in by sholloway, 6 years ago)

A few bug fixes from code rot
Added support for creating compound skin objects
Fixed some bugs with the frame mover

Line 
1 #!/usr/bin/env python
2 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 ##~ License
4 ##~
5 ##- The RuneBlade Foundation library is intended to ease some
6 ##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.)
7 ##- applications, while providing the flexibility to modularly change the
8 ##- architecture. Enjoy.
9 ##~
10 ##~ Copyright (C) 2002  TechGame Networks, LLC.
11 ##~
12 ##~ This library is free software; you can redistribute it and/or
13 ##~ modify it under the terms of the BSD style License as found in the
14 ##~ LICENSE file included with this distribution.
15 ##~
16 ##~ TechGame Networks, LLC can be reached at:
17 ##~ 3578 E. Hartsel Drive #211
18 ##~ Colorado Springs, Colorado, USA, 80920
19 ##~
20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 #~ Imports
24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25
26 from wxSkinObject import wx, wxSkinObject, wxSkinObjectNoData
27 from RBSkinning.wxTools.wxFrameMover import *
28
29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 #~ Definitions
31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
33 class frame_mover(wxSkinObject, wxSkinObjectNoData):
34     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35     #~ Constants / Variables / Etc.
36     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37
38     default_settings = wxSkinObject.default_settings.copy()
39     default_settings.update({
40         'ref':'frame',
41         #'dragbutton':'any',
42         #'sizeframe':'0,0',
43         })
44
45     dragbuttonlookup = {
46         None: wxFrameMover.DefaultButton,
47         '': wxFrameMover.DefaultButton,
48         '0': wxFrameMover.DefaultButton,
49
50         'any': wxFrameMover.AnyButton,
51         '-1': wxFrameMover.AnyButton,
52
53         'left': wxFrameMover.LeftButton,
54         '1': wxFrameMover.LeftButton,
55
56         'middle': wxFrameMover.MiddleButton,
57         'center': wxFrameMover.MiddleButton,
58         '2': wxFrameMover.MiddleButton,
59
60         'right': wxFrameMover.RightButton,
61         '3': wxFrameMover.RightButton,
62         }
63
64     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65     #~ Public
66     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
68     def SkinInitialize(self):
69         frame = self.context.getnamedvar(self.settings.get('ref', 'frame'))
70         sizeframe = self.wxEvalCond('sizeframe', (0,0))
71         dragbutton = self.dragbuttonlookup.get(self.settings.get('dragbutton'))
72         self.object = wxFrameMover(frame, sizeframe, dragbutton)
73  
74     def SkinFinalize(self):
75         parentobject = self.wxGetParentObject(wx.wxWindowPtr)
76         parentobject.SetNextHandler(self.object)
77         self.object.SetPreviousHandler(parentobject)
78
Note: See TracBrowser for help on using the browser.