]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/toplevel.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // ============================================================================
12 // ============================================================================
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
19 #pragma implementation "toplevel.h"
22 // For compilers that support precompilation, includes "wx.h".
23 #include "wx/wxprec.h"
30 #include "wx/toplevel.h"
32 // ----------------------------------------------------------------------------
34 // ----------------------------------------------------------------------------
36 extern void wxapp_install_idle_handler();
38 extern int g_openDialogs
;
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
44 #ifndef __WXUNIVERSAL__
45 IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow
, wxWindow
)
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
52 extern wxList wxPendingDelete
;
55 // ============================================================================
57 // ============================================================================
59 void wxTopLevelWindowMGL::Init()
62 m_isMaximized
= FALSE
;
63 m_fsIsShowing
= FALSE
;
66 bool wxTopLevelWindowMGL::Create(wxWindow
*parent
,
68 const wxString
& title
,
70 const wxSize
& sizeOrig
,
74 // always create a frame of some reasonable, even if arbitrary, size (at
75 // least for MSW compatibility)
76 wxSize size
= sizeOrig
;
77 if ( size
.x
== -1 || size
.y
== -1 )
79 wxSize sizeDpy
= wxGetDisplaySize();
81 size
.x
= sizeDpy
.x
/ 3;
83 size
.y
= sizeDpy
.y
/ 5;
86 wxTopLevelWindows
.Append(this);
92 m_parent
->AddChild(this);
97 wxTopLevelWindowMGL::~wxTopLevelWindowMGL()
99 m_isBeingDeleted
= TRUE
;
101 wxTopLevelWindows
.DeleteObject(this);
103 if (wxTheApp
->GetTopWindow() == this)
104 wxTheApp
->SetTopWindow(NULL
);
106 if ((wxTopLevelWindows
.Number() == 0) &&
107 (wxTheApp
->GetExitOnFrameDelete()))
109 wxTheApp
->ExitMainLoop();
113 bool wxTopLevelWindowMGL::ShowFullScreen(bool show
, long style
)
115 if (show
== m_fsIsShowing
) return FALSE
; // return what?
117 m_fsIsShowing
= show
;
121 m_fsSaveStyle
= m_windowStyle
;
122 m_fsSaveFlag
= style
;
123 GetPosition(&m_fsSaveFrame
.x
, &m_fsSaveFrame
.y
);
124 GetSize(&m_fsSaveFrame
.width
, &m_fsSaveFrame
.height
);
126 if ( style
& wxFULLSCREEN_NOCAPTION
)
127 m_windowStyle
&= !wxCAPTION
;
128 if ( style
& wxFULLSCREEN_NOBORDER
)
129 m_windowStyle
= wxSIMPLE_BORDER
;
132 wxDisplaySize(&x
, &y
);
137 m_windowStyle
= m_fsSaveStyle
;
138 SetSize(m_fsSaveFrame
.x
, m_fsSaveFrame
.y
,
139 m_fsSaveFrame
.width
, m_fsSaveFrame
.height
);
145 void wxTopLevelWindowMGL::Maximize(bool maximize
)
147 if ( maximize
&& !m_isMaximized
)
151 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
152 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
154 wxClientDisplayRect(&x
, &y
, &w
, &h
);
156 m_isMaximized
= TRUE
;
158 else if ( !maximize
&& m_isMaximized
)
160 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
161 m_savedFrame
.width
, m_savedFrame
.height
);
162 m_isMaximized
= FALSE
;
166 bool wxTopLevelWindowMGL::IsMaximized() const
168 return m_isMaximized
;
171 void wxTopLevelWindowMGL::Restore()
183 void wxTopLevelWindowMGL::Iconize(bool iconize
)
188 bool wxTopLevelWindowMGL::IsIconized() const