| 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 |
import warnings |
|---|
| 27 |
import wxPositionKeeper |
|---|
| 28 |
|
|---|
| 29 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 30 |
#~ Warnings |
|---|
| 31 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 32 |
|
|---|
| 33 |
warnings.warn('wxWinFullScreen has been obviated by the addition of wxFrame::ShowFullScreen', DeprecationWarning) |
|---|
| 34 |
|
|---|
| 35 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 36 |
#~ Definitions |
|---|
| 37 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 38 |
|
|---|
| 39 |
class wxWinFullScreen(object): |
|---|
| 40 |
def RestoreScreen(self): |
|---|
| 41 |
self.FullScreen(None, None) |
|---|
| 42 |
|
|---|
| 43 |
_fullscreenpos = None |
|---|
| 44 |
def FullScreen(self, w, h, window=None): |
|---|
| 45 |
if w and h: |
|---|
| 46 |
self._GetTopLevelWindowFrom(window) |
|---|
| 47 |
if self._fullscreenpos and self._fullscreenpos[1] is not frame: |
|---|
| 48 |
self._fullscreenpos[0].Restore(self._fullscreenpos[1]) |
|---|
| 49 |
del self._fullscreenpos |
|---|
| 50 |
if not self._fullscreenpos: |
|---|
| 51 |
self._fullscreenpos = wxPositionKeeper.wxPositionKeeper(frame), frame |
|---|
| 52 |
frame.SetClientSizeWH(w+1,h+1) |
|---|
| 53 |
x,y = frame.GetPositionTuple() |
|---|
| 54 |
xc,yc = frame.ClientToScreenXY(0,0) |
|---|
| 55 |
frame.MoveXY(x-xc,y-yc) |
|---|
| 56 |
winUitls.ChangeDisplaySettings(w,h) |
|---|
| 57 |
else: |
|---|
| 58 |
if self._fullscreenpos: |
|---|
| 59 |
self._fullscreenpos[0].Restore(self._fullscreenpos[1]) |
|---|
| 60 |
del self._fullscreenpos |
|---|
| 61 |
winUitls.ChangeDisplaySettings() |
|---|
| 62 |
|
|---|
| 63 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 64 |
|
|---|
| 65 |
def _GetTopLevelWindowFrom(self, window=None): |
|---|
| 66 |
window = window or self.window |
|---|
| 67 |
while window.GetParent(): |
|---|
| 68 |
window = window.GetParent() |
|---|
| 69 |
return window |
|---|
| 70 |
|
|---|