| 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, wxSkinWindowObject, wxSkinObjectNoData |
|---|
| 27 |
from RBSkinning.wxTools import wxLockingFrame |
|---|
| 28 |
|
|---|
| 29 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 30 |
#~ Class |
|---|
| 31 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 32 |
|
|---|
| 33 |
class frame(wxSkinWindowObject, wxSkinObjectNoData): |
|---|
| 34 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 35 |
#~ Constants / Variables / Etc. |
|---|
| 36 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 37 |
|
|---|
| 38 |
default_settings = wxSkinWindowObject.default_settings.copy() |
|---|
| 39 |
default_settings.update({ |
|---|
| 40 |
'name': __name__, |
|---|
| 41 |
'wxid': 'wx.wxNewId()', |
|---|
| 42 |
'style': 'wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN', |
|---|
| 43 |
'title': 'Frame', |
|---|
| 44 |
#'topframe': 'False', |
|---|
| 45 |
#'toplevel': 'True', |
|---|
| 46 |
'ctxvar': 'frame', |
|---|
| 47 |
#'locking': 'None', |
|---|
| 48 |
}) |
|---|
| 49 |
|
|---|
| 50 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 51 |
#~ Public |
|---|
| 52 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 53 |
|
|---|
| 54 |
def SkinInitialize(self): |
|---|
| 55 |
self.PushContext() |
|---|
| 56 |
winParent = self.wxGetParentObject(wx.wxFramePtr) |
|---|
| 57 |
if winParent is None and not self.wxEvalCond('toplevel', True): |
|---|
| 58 |
app = self.context.application |
|---|
| 59 |
if app is not None: |
|---|
| 60 |
winParent = app.GetTopWindow() |
|---|
| 61 |
kwSettings = self.wxSettingDict(['wxid', 'style', 'pos', 'size'], ['name', 'title']) |
|---|
| 62 |
|
|---|
| 63 |
locking = self.settings.get('locking', '').lower() |
|---|
| 64 |
if locking in ['standard', 'yes', '1', 'true']: |
|---|
| 65 |
self.object = wxLockingFrame.wxLockingFrame(winParent,**kwSettings) |
|---|
| 66 |
elif locking in ['attractive']: |
|---|
| 67 |
self.object = wxLockingFrame.wxAttractiveLockingFrame(winParent,**kwSettings) |
|---|
| 68 |
elif locking in ['resistive']: |
|---|
| 69 |
self.object = wxLockingFrame.wxResistiveLockingFrame(winParent,**kwSettings) |
|---|
| 70 |
else: |
|---|
| 71 |
self.object = wx.wxFrame(winParent,**kwSettings) |
|---|
| 72 |
|
|---|
| 73 |
if self.wxEvalCond('topframe', False): |
|---|
| 74 |
self.context.application.SetTopWindow(self.object) |
|---|
| 75 |
self.wxInitialStandardOptions() |
|---|
| 76 |
|
|---|
| 77 |
def SkinFinalize(self): |
|---|
| 78 |
self.wxFinalStandardOptions() |
|---|
| 79 |
|
|---|
| 80 |
# hack to force relayout in some cases |
|---|
| 81 |
w,h = self.object.GetSize() |
|---|
| 82 |
self.object.SetSize((w+1,h+1)) |
|---|
| 83 |
self.object.SetSize((w,h)) |
|---|
| 84 |
|
|---|
| 85 |
self.object.Layout() |
|---|
| 86 |
|
|---|