]>
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 int g_openDialogs
;
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
42 #ifndef __WXUNIVERSAL__
43 IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow
, wxWindow
)
47 // ============================================================================
49 // ============================================================================
51 void wxTopLevelWindowMGL::Init()
54 m_isMaximized
= FALSE
;
55 m_fsIsShowing
= FALSE
;
58 bool wxTopLevelWindowMGL::Create(wxWindow
*parent
,
60 const wxString
& title
,
62 const wxSize
& sizeOrig
,
66 // always create a frame of some reasonable, even if arbitrary, size (at
67 // least for MSW compatibility)
68 wxSize size
= sizeOrig
;
69 if ( size
.x
== -1 || size
.y
== -1 )
71 wxSize sizeDpy
= wxGetDisplaySize();
73 size
.x
= sizeDpy
.x
/ 3;
75 size
.y
= sizeDpy
.y
/ 5;
78 wxTopLevelWindows
.Append(this);
84 m_parent
->AddChild(this);
89 wxTopLevelWindowMGL::~wxTopLevelWindowMGL()
91 m_isBeingDeleted
= TRUE
;
93 wxTopLevelWindows
.DeleteObject(this);
95 if (wxTheApp
->GetTopWindow() == this)
96 wxTheApp
->SetTopWindow(NULL
);
98 if ((wxTopLevelWindows
.Number() == 0) &&
99 (wxTheApp
->GetExitOnFrameDelete()))
101 wxTheApp
->ExitMainLoop();
105 bool wxTopLevelWindowMGL::ShowFullScreen(bool show
, long style
)
107 if (show
== m_fsIsShowing
) return FALSE
; // return what?
109 m_fsIsShowing
= show
;
113 m_fsSaveStyle
= m_windowStyle
;
114 m_fsSaveFlag
= style
;
115 GetPosition(&m_fsSaveFrame
.x
, &m_fsSaveFrame
.y
);
116 GetSize(&m_fsSaveFrame
.width
, &m_fsSaveFrame
.height
);
118 if ( style
& wxFULLSCREEN_NOCAPTION
)
119 m_windowStyle
&= ~wxCAPTION
;
120 if ( style
& wxFULLSCREEN_NOBORDER
)
121 m_windowStyle
= wxSIMPLE_BORDER
;
124 wxDisplaySize(&x
, &y
);
129 m_windowStyle
= m_fsSaveStyle
;
130 SetSize(m_fsSaveFrame
.x
, m_fsSaveFrame
.y
,
131 m_fsSaveFrame
.width
, m_fsSaveFrame
.height
);
137 void wxTopLevelWindowMGL::Maximize(bool maximize
)
139 if ( maximize
&& !m_isMaximized
)
143 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
144 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
146 wxClientDisplayRect(&x
, &y
, &w
, &h
);
148 m_isMaximized
= TRUE
;
150 else if ( !maximize
&& m_isMaximized
)
152 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
153 m_savedFrame
.width
, m_savedFrame
.height
);
154 m_isMaximized
= FALSE
;
158 bool wxTopLevelWindowMGL::IsMaximized() const
160 return m_isMaximized
;
163 void wxTopLevelWindowMGL::Restore()
175 void wxTopLevelWindowMGL::Iconize(bool iconize
)
180 bool wxTopLevelWindowMGL::IsIconized() const