]> git.saurik.com Git - wxWidgets.git/blame - src/x11/toplevel.cpp
use WXUNUSED(foo), not (void)foo
[wxWidgets.git] / src / x11 / toplevel.cpp
CommitLineData
1b0fb34b
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: x11/toplevel.cpp
3// Purpose: implements wxTopLevelWindow for X11
83df96d6
JS
4// Author: Julian Smart
5// Modified by:
1b0fb34b 6// Created: 24.09.01
83df96d6 7// RCS-ID: $Id$
1b0fb34b
JS
8// Copyright: (c) 2002 Julian Smart
9// License: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
83df96d6
JS
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#ifdef __GNUG__
1b0fb34b 21 #pragma implementation "toplevel.h"
83df96d6
JS
22#endif
23
1b0fb34b
JS
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
83df96d6 26
1b0fb34b
JS
27#ifdef __BORLANDC__
28 #pragma hdrstop
83df96d6
JS
29#endif
30
1b0fb34b
JS
31#ifndef WX_PRECOMP
32 #include "wx/app.h"
33 #include "wx/toplevel.h"
34 #include "wx/string.h"
35 #include "wx/log.h"
36 #include "wx/intl.h"
37 #include "wx/frame.h"
38#endif //WX_PRECOMP
83df96d6 39
1b0fb34b 40#include "wx/x11/private.h"
83df96d6
JS
41
42// ----------------------------------------------------------------------------
43// globals
44// ----------------------------------------------------------------------------
45
1b0fb34b
JS
46// list of all frames and modeless dialogs
47// wxWindowList wxModelessWindows;
83df96d6
JS
48
49// ----------------------------------------------------------------------------
1b0fb34b 50// wxTopLevelWindowX11 creation
83df96d6
JS
51// ----------------------------------------------------------------------------
52
1b0fb34b
JS
53void wxTopLevelWindowX11::Init()
54{
55 m_iconized =
56 m_maximizeOnShow = FALSE;
83df96d6 57
1b0fb34b
JS
58 // unlike (almost?) all other windows, frames are created hidden
59 m_isShown = FALSE;
83df96d6 60
1b0fb34b
JS
61 // Data to save/restore when calling ShowFullScreen
62 m_fsStyle = 0;
63 m_fsIsMaximized = FALSE;
64 m_fsIsShowing = FALSE;
65}
83df96d6 66
1b0fb34b
JS
67bool wxTopLevelWindowX11::CreateDialog(const wxString& title,
68 const wxPoint& pos,
69 const wxSize& size)
83df96d6 70{
1b0fb34b
JS
71 // TODO
72 return FALSE;
83df96d6
JS
73}
74
1b0fb34b
JS
75bool wxTopLevelWindowX11::CreateFrame(const wxString& title,
76 const wxPoint& pos,
77 const wxSize& size)
83df96d6 78{
1b0fb34b
JS
79 // TODO
80 return FALSE;
81}
83df96d6 82
1b0fb34b
JS
83bool wxTopLevelWindowX11::Create(wxWindow *parent,
84 wxWindowID id,
85 const wxString& title,
86 const wxPoint& pos,
87 const wxSize& size,
88 long style,
89 const wxString& name)
90{
91 // init our fields
92 Init();
83df96d6
JS
93
94 m_windowStyle = style;
95
1b0fb34b 96 SetName(name);
83df96d6 97
1b0fb34b 98 m_windowId = id == -1 ? NewControlId() : id;
83df96d6 99
1b0fb34b 100 wxTopLevelWindows.Append(this);
83df96d6 101
1b0fb34b
JS
102 if ( parent )
103 parent->AddChild(this);
83df96d6 104
1b0fb34b 105 if ( GetExtraStyle() & wxTOPLEVEL_EX_DIALOG )
83df96d6 106 {
1b0fb34b 107 return CreateDialog(title, pos, size);
83df96d6 108 }
1b0fb34b 109 else // !dialog
83df96d6 110 {
1b0fb34b 111 return CreateFrame(title, pos, size);
83df96d6 112 }
83df96d6
JS
113}
114
1b0fb34b 115wxTopLevelWindowX11::~wxTopLevelWindowX11()
83df96d6 116{
83df96d6 117 wxTopLevelWindows.DeleteObject(this);
83df96d6 118
1b0fb34b
JS
119 if ( wxModelessWindows.Find(this) )
120 wxModelessWindows.DeleteObject(this);
83df96d6 121
1b0fb34b
JS
122 // If this is the last top-level window, exit.
123 if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
83df96d6
JS
124 {
125 wxTheApp->SetTopWindow(NULL);
126
127 if (wxTheApp->GetExitOnFrameDelete())
128 {
129 // Signal to the app that we're going to close
130 wxTheApp->ExitMainLoop();
131 }
132 }
133}
134
1b0fb34b
JS
135// ----------------------------------------------------------------------------
136// wxTopLevelWindowX11 showing
137// ----------------------------------------------------------------------------
83df96d6 138
1b0fb34b 139bool wxTopLevelWindowX11::Show(bool show)
83df96d6 140{
1b0fb34b
JS
141 if ( !wxWindowBase::Show(show) )
142 return FALSE;
83df96d6 143
1b0fb34b 144 // TODO
83df96d6 145
83df96d6
JS
146 return TRUE;
147}
148
1b0fb34b
JS
149// ----------------------------------------------------------------------------
150// wxTopLevelWindowX11 maximize/minimize
151// ----------------------------------------------------------------------------
83df96d6 152
1b0fb34b 153void wxTopLevelWindowX11::Maximize(bool maximize)
83df96d6 154{
1b0fb34b 155 // TODO
83df96d6
JS
156}
157
1b0fb34b 158bool wxTopLevelWindowX11::IsMaximized() const
83df96d6 159{
1b0fb34b
JS
160 // TODO
161 return TRUE;
83df96d6
JS
162}
163
1b0fb34b 164void wxTopLevelWindowX11::Iconize(bool iconize)
83df96d6 165{
1b0fb34b 166 // TODO
83df96d6
JS
167}
168
1b0fb34b 169bool wxTopLevelWindowX11::IsIconized() const
83df96d6 170{
1b0fb34b
JS
171 // TODO
172 return m_iconized;
83df96d6
JS
173}
174
1b0fb34b 175void wxTopLevelWindowX11::Restore()
83df96d6 176{
1b0fb34b 177 // TODO
83df96d6
JS
178}
179
1b0fb34b
JS
180// ----------------------------------------------------------------------------
181// wxTopLevelWindowX11 fullscreen
182// ----------------------------------------------------------------------------
83df96d6 183
1b0fb34b 184bool wxTopLevelWindowX11::ShowFullScreen(bool show, long style)
83df96d6 185{
1b0fb34b 186 if (show)
83df96d6 187 {
1b0fb34b
JS
188 if (IsFullScreen())
189 return FALSE;
83df96d6 190
1b0fb34b
JS
191 m_fsIsShowing = TRUE;
192 m_fsStyle = style;
83df96d6 193
1b0fb34b 194 // TODO
83df96d6 195
1b0fb34b 196 return TRUE;
83df96d6 197 }
1b0fb34b 198 else
83df96d6 199 {
1b0fb34b
JS
200 if (!IsFullScreen())
201 return FALSE;
83df96d6 202
1b0fb34b 203 m_fsIsShowing = FALSE;
83df96d6 204
1b0fb34b
JS
205 // TODO
206 return TRUE;
83df96d6
JS
207 }
208}
209
1b0fb34b
JS
210// ----------------------------------------------------------------------------
211// wxTopLevelWindowX11 misc
212// ----------------------------------------------------------------------------
83df96d6 213
1b0fb34b 214void wxTopLevelWindowX11::SetIcon(const wxIcon& icon)
83df96d6 215{
1b0fb34b
JS
216 // this sets m_icon
217 wxTopLevelWindowBase::SetIcon(icon);
83df96d6 218
83df96d6
JS
219 // TODO
220}