]>
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"
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 extern int g_openDialogs
;
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 #ifndef __WXUNIVERSAL__
44 IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow
, wxWindow
)
48 // ============================================================================
50 // ============================================================================
52 void wxTopLevelWindowMGL::Init()
56 m_isMaximized
= FALSE
;
57 m_fsIsShowing
= FALSE
;
60 bool wxTopLevelWindowMGL::Create(wxWindow
*parent
,
62 const wxString
& title
,
64 const wxSize
& sizeOrig
,
68 // always create a frame of some reasonable, even if arbitrary, size (at
69 // least for MSW compatibility)
70 wxSize size
= sizeOrig
;
71 if ( size
.x
== -1 || size
.y
== -1 )
73 wxSize sizeDpy
= wxGetDisplaySize();
75 size
.x
= sizeDpy
.x
/ 3;
77 size
.y
= sizeDpy
.y
/ 5;
80 wxWindow::Create(parent
, id
, pos
, sizeOrig
, style
, name
);
82 wxTopLevelWindows
.Append(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 bool wxTopLevelWindowMGL::Show(bool show
)
139 bool ret
= wxTopLevelWindowBase::Show(show
);
140 if ( ret
&& show
&& AcceptsFocus() )
142 // FIXME_MGL -- don't do this for popup windows?
146 void wxTopLevelWindowMGL::Maximize(bool maximize
)
148 if ( maximize
&& !m_isMaximized
)
152 m_isMaximized
= TRUE
;
154 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
155 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
157 wxClientDisplayRect(&x
, &y
, &w
, &h
);
160 else if ( !maximize
&& m_isMaximized
)
162 m_isMaximized
= FALSE
;
163 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
164 m_savedFrame
.width
, m_savedFrame
.height
);
168 bool wxTopLevelWindowMGL::IsMaximized() const
170 return m_isMaximized
;
173 void wxTopLevelWindowMGL::Restore()
185 void wxTopLevelWindowMGL::Iconize(bool iconize
)
187 // FIXME_MGL - use wxDesktop for this
190 bool wxTopLevelWindowMGL::IsIconized() const