]>
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);
86 // FIXME_MGL -- should activate itself when shown!
91 wxTopLevelWindowMGL::~wxTopLevelWindowMGL()
93 m_isBeingDeleted
= TRUE
;
95 wxTopLevelWindows
.DeleteObject(this);
97 if (wxTheApp
->GetTopWindow() == this)
98 wxTheApp
->SetTopWindow(NULL
);
100 if ((wxTopLevelWindows
.Number() == 0) &&
101 (wxTheApp
->GetExitOnFrameDelete()))
103 wxTheApp
->ExitMainLoop();
107 bool wxTopLevelWindowMGL::ShowFullScreen(bool show
, long style
)
109 if (show
== m_fsIsShowing
) return FALSE
; // return what?
111 m_fsIsShowing
= show
;
115 m_fsSaveStyle
= m_windowStyle
;
116 m_fsSaveFlag
= style
;
117 GetPosition(&m_fsSaveFrame
.x
, &m_fsSaveFrame
.y
);
118 GetSize(&m_fsSaveFrame
.width
, &m_fsSaveFrame
.height
);
120 if ( style
& wxFULLSCREEN_NOCAPTION
)
121 m_windowStyle
&= ~wxCAPTION
;
122 if ( style
& wxFULLSCREEN_NOBORDER
)
123 m_windowStyle
= wxSIMPLE_BORDER
;
126 wxDisplaySize(&x
, &y
);
131 m_windowStyle
= m_fsSaveStyle
;
132 SetSize(m_fsSaveFrame
.x
, m_fsSaveFrame
.y
,
133 m_fsSaveFrame
.width
, m_fsSaveFrame
.height
);
139 void wxTopLevelWindowMGL::Maximize(bool maximize
)
141 if ( maximize
&& !m_isMaximized
)
145 GetPosition(&m_savedFrame
.x
, &m_savedFrame
.y
);
146 GetSize(&m_savedFrame
.width
, &m_savedFrame
.height
);
148 wxClientDisplayRect(&x
, &y
, &w
, &h
);
150 m_isMaximized
= TRUE
;
152 else if ( !maximize
&& m_isMaximized
)
154 SetSize(m_savedFrame
.x
, m_savedFrame
.y
,
155 m_savedFrame
.width
, m_savedFrame
.height
);
156 m_isMaximized
= FALSE
;
160 bool wxTopLevelWindowMGL::IsMaximized() const
162 return m_isMaximized
;
165 void wxTopLevelWindowMGL::Restore()
177 void wxTopLevelWindowMGL::Iconize(bool iconize
)
179 // FIXME_MGL - use wxDesktop for this
182 bool wxTopLevelWindowMGL::IsIconized() const