{
public:
wxDialogBase() { Init(); }
- ~wxDialogBase() {}
-
+ virtual ~wxDialogBase() { }
+
void Init();
-
+
// the modal dialogs have a return code - usually the id of the last
// pressed button
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
// lines into a vertical wxBoxSizer
wxSizer *CreateTextSizer( const wxString &message );
#endif // wxUSE_STATTEXT && wxUSE_TEXTCTRL
-
+
#if wxUSE_BUTTON
// places buttons into a horizontal wxBoxSizer
wxSizer *CreateButtonSizer( long flags );
int m_returnCode;
// FIXME - temporary hack in absence of wxTLW !!
- #ifdef wxTopLevelWindowNative
+#ifdef wxTopLevelWindowNative
DECLARE_EVENT_TABLE()
WX_DECLARE_CONTROL_CONTAINER();
- #endif
+#endif
};
/////////////////////////////////////////////////////////////////////////////
-// Name: dialog.h
+// Name: wx/msw/dialog.h
// Purpose: wxDialog class
// Author: Julian Smart
// Modified by:
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxDialogNameStr);
- ~wxDialog();
-
- // override some base class virtuals
- virtual bool Destroy();
- virtual bool Show(bool show);
- virtual void Iconize(bool iconize);
- virtual bool IsIconized() const;
-
- virtual bool IsTopLevel() const { return TRUE; }
+ virtual ~wxDialog();
void SetModal(bool flag);
virtual bool IsModal() const;
// returns TRUE if we're in a modal loop
bool IsModalShowing() const;
-#if WXWIN_COMPATIBILITY
- bool Iconized() const { return IsIconized(); };
-#endif
-
// wxMSW only: remove the "Close" button from the dialog
bool EnableCloseButton(bool enable = TRUE);
// implementation only from now on
// -------------------------------
+ // override some base class virtuals
+ virtual bool Show(bool show);
+
// event handlers
bool OnClose();
void OnCharHook(wxKeyEvent& event);
#endif // wxUSE_CTL3D
protected:
- // override more base class virtuals
- virtual void DoSetClientSize(int width, int height);
- virtual void DoGetPosition(int *x, int *y) const;
-
// show modal dialog and enter modal loop
void DoShowModal();
virtual ~wxFrameMSW();
// implement base class pure virtuals
- virtual void Raise();
- virtual void Maximize(bool maximize = TRUE);
- virtual bool IsMaximized() const;
- virtual void Iconize(bool iconize = TRUE);
- virtual bool IsIconized() const;
- virtual void Restore();
- virtual void SetIcon(const wxIcon& icon);
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
virtual bool IsFullScreen() const { return m_fsIsShowing; };
+ virtual void Raise();
// implementation only from now on
// -------------------------------
- // override some more virtuals
- virtual bool Show(bool show = TRUE);
-
// event handlers
void OnActivate(wxActivateEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
// common part of all ctors
void Init();
- // common part of Iconize(), Maximize() and Restore()
- void DoShowWindow(int nShowCmd);
-
// override base class virtuals
virtual void DoGetClientSize(int *width, int *height) const;
- virtual void DoGetSize(int *width, int *height) const;
- virtual void DoGetPosition(int *x, int *y) const;
-
virtual void DoSetClientSize(int width, int height);
#if wxUSE_MENUS_NATIVE
virtual bool IsMDIChild() const { return FALSE; }
- // is the frame currently iconized?
- bool m_iconized;
-
- // should the frame be maximized when it will be shown? set by Maximize()
- // when it is called while the frame is hidden
- bool m_maximizeOnShow;
-
- WXHICON m_defaultIcon;
+ // get default (wxWindows) icon for the frame
+ virtual WXHICON GetDefaultIcon() const;
#if wxUSE_STATUSBAR
static bool m_useNativeStatusBar;
class WXDLLEXPORT wxMDIParentFrame : public wxFrame
{
- DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
-
public:
wxMDIParentFrame();
wxMDIParentFrame(wxWindow *parent,
virtual void InternalSetMenuBar();
#endif // wxUSE_MENUS_NATIVE
+ virtual WXHICON GetDefaultIcon() const;
+
wxMDIClientWindow * m_clientWindow;
wxMDIChildFrame * m_currentChild;
wxMenu* m_windowMenu;
friend class WXDLLEXPORT wxMDIChildFrame;
DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
};
// ---------------------------------------------------------------------------
virtual void InternalSetMenuBar();
virtual bool IsMDIChild() const { return TRUE; }
+ virtual WXHICON GetDefaultIcon() const;
+
// common part of all ctors
void Init();
return (::GetKeyState(VK_CONTROL) & 0x100) != 0;
}
+// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking
+// for Win32
+inline RECT wxGetWindowRect(HWND hwnd)
+{
+ RECT rect;
+#ifdef __WIN16__
+ ::GetWindowRect(hwnd, &rect);
+#else // Win32
+ if ( !::GetWindowRect(hwnd, &rect) )
+ {
+ wxLogLastError(_T("GetWindowRect"));
+ }
+#endif // Win16/32
+
+ return rect;
+}
+
+inline RECT wxGetClientRect(HWND hwnd)
+{
+ RECT rect;
+#ifdef __WIN16__
+ ::GetClientRect(hwnd, &rect);
+#else // Win32
+ if ( !::GetClientRect(hwnd, &rect) )
+ {
+ wxLogLastError(_T("GetClientRect"));
+ }
+#endif // Win16/32
+
+ return rect;
+}
+
// ---------------------------------------------------------------------------
// small helper classes
// ---------------------------------------------------------------------------
// Does this window style specify any border?
inline bool wxStyleHasBorder(long style)
{
- return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER |
- wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
+ return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER |
+ wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
}
// find the window for HWND which is part of some wxWindow, returns just the
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/msw/toplevel.h
+// Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.09.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MSW_TOPLEVEL_H_
+#define _WX_MSW_TOPLEVEL_H_
+
+#ifdef __GNUG__
+ #pragma interface "toplevel.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW
+// ----------------------------------------------------------------------------
+
+class wxTopLevelWindowMSW : public wxTopLevelWindowBase
+{
+public:
+ // constructors and such
+ wxTopLevelWindowMSW() { Init(); }
+
+ wxTopLevelWindowMSW(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ virtual ~wxTopLevelWindowMSW();
+
+ // implement base class pure virtuals
+ virtual void Maximize(bool maximize = TRUE);
+ virtual bool IsMaximized() const;
+ virtual void Iconize(bool iconize = TRUE);
+ virtual bool IsIconized() const;
+ virtual void SetIcon(const wxIcon& icon);
+ virtual void Restore();
+
+ virtual bool Show(bool show = TRUE);
+
+ // implementation from now on
+ // --------------------------
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // common part of Iconize(), Maximize() and Restore()
+ void DoShowWindow(int nShowCmd);
+
+ // implement the geometry-related methods for a top level window
+ virtual void DoSetClientSize(int width, int height);
+
+ // is the frame currently iconized?
+ bool m_iconized;
+
+ // should the frame be maximized when it will be shown? set by Maximize()
+ // when it is called while the frame is hidden
+ bool m_maximizeOnShow;
+};
+
+// list of all frames and modeless dialogs
+extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
+
+#endif // _WX_MSW_TOPLEVEL_H_
+
public:
// construction
wxTopLevelWindowBase();
-#ifdef __DARWIN__
- virtual ~wxTopLevelWindowBase() {}
-#endif
-
+
// top level wnd state
// --------------------
// so should be there for all platforms
void OnActivate(wxActivateEvent &WXUNUSED(event)) { }
+#ifdef __DARWIN__
+ virtual ~wxTopLevelWindowBase() {}
+#endif
+
protected:
// the frame client to screen translation should take account of the
// toolbar which may shift the origin of the client area
// include the real class declaration
-#if defined(__WXGTK__)
+#if defined(__WXMSW__)
+ #include "wx/msw/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowMSW
+#elif defined(__WXGTK__)
#include "wx/gtk/toplevel.h"
#define wxTopLevelWindowNative wxTopLevelWindowGTK
#elif defined(__WXMGL__)
#include "wx/wx.h"
#endif
+#include "wx/dynarray.h"
+
+WX_DEFINE_ARRAY(wxWindow *, wxArrayLboxes);
+
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
// event handlers (these functions should _not_ be virtual)
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
+ void OnCreateLbox(wxCommandEvent& event);
+ void OnDeleteLbox(wxCommandEvent& event);
private:
+ wxArrayLboxes m_lboxes;
+ wxCoord m_pos;
+
// any class wishing to process wxWindows events must use this macro
DECLARE_EVENT_TABLE()
};
{
// menu items
Minimal_Quit = 1,
- Minimal_About
+ Minimal_About,
+ Minimal_CreateLbox,
+ Minimal_DeleteLbox,
};
+static const size_t NUM_LBOXES = 10;
+static const wxCoord POS_STEP = 5;
+
// ----------------------------------------------------------------------------
// event tables and other macros for wxWindows
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout)
+ EVT_MENU(Minimal_CreateLbox, MyFrame::OnCreateLbox)
+ EVT_MENU(Minimal_DeleteLbox, MyFrame::OnDeleteLbox)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
// not wxApp)
IMPLEMENT_APP(MyApp)
-
// ============================================================================
// implementation
// ============================================================================
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
+ m_pos = 0;
+
#ifdef __WXMAC__
// we need this in order to allow the about menu relocation, since ABOUT is
// not the default id of the about menu
// the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog");
+ helpMenu->Append(Minimal_CreateLbox, "&Create 10 listboxes\tCtrl-C");
+ helpMenu->Append(Minimal_DeleteLbox, "&Delete 10 listboxes\tCtrl-D");
menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
wxMessageBox(msg, "About Minimal", wxOK | wxICON_INFORMATION, this);
}
+
+void MyFrame::OnCreateLbox(wxCommandEvent& WXUNUSED(event))
+{
+ for ( size_t n = 0; n < NUM_LBOXES; n++ )
+ {
+ m_lboxes.Add(new wxListBox(this, -1, wxPoint(m_pos, m_pos)));
+ m_pos += POS_STEP;
+ }
+}
+
+void MyFrame::OnDeleteLbox(wxCommandEvent& WXUNUSED(event))
+{
+ size_t count = m_lboxes.GetCount();
+ if ( count < NUM_LBOXES )
+ return;
+
+ for ( size_t n = 0; n < NUM_LBOXES; n++ )
+ {
+ delete m_lboxes[--count];
+ m_lboxes.RemoveAt(count);
+
+ m_pos -= POS_STEP;
+ }
+}
+
// implementation
// ============================================================================
+IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow, wxWindow)
+
// ----------------------------------------------------------------------------
// construction/destruction
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
-// wxTopLevelWindow size management: we exclude the areas taken by menu/status/toolbars
-// from the client area, so the client area is what's really available for the
-// frame contents
+// wxTopLevelWindow size management: we exclude the areas taken by
+// menu/status/toolbars from the client area, so the client area is what's
+// really available for the frame contents
// ----------------------------------------------------------------------------
void wxTopLevelWindowBase::DoScreenToClient(int *x, int *y) const
{
wxWindow::DoScreenToClient(x, y);
- // We may be faking the client origin.
- // So a window that's really at (0, 30) may appear
- // (to wxWin apps) to be at (0, 0).
+ // translate the wxWindow client coords to our client coords
wxPoint pt(GetClientAreaOrigin());
- *x -= pt.x;
- *y -= pt.y;
+ if ( x )
+ *x -= pt.x;
+ if ( y )
+ *y -= pt.y;
}
void wxTopLevelWindowBase::DoClientToScreen(int *x, int *y) const
{
- // We may be faking the client origin.
- // So a window that's really at (0, 30) may appear
- // (to wxWin apps) to be at (0, 0).
- wxPoint pt1(GetClientAreaOrigin());
- *x += pt1.x;
- *y += pt1.y;
+ // our client area origin (0, 0) may be really something like (0, 30) for
+ // wxWindow if we have a toolbar, account for it before translating
+ wxPoint pt(GetClientAreaOrigin());
+ if ( x )
+ *x += pt.x;
+ if ( y )
+ *y += pt.y;
wxWindow::DoClientToScreen(x, y);
}
long style, const wxString &name )
{
Init();
-
- // all dialogs should have tab traversal enabled
- style |= wxTAB_TRAVERSAL;
- Create( parent, id, title, pos, size, style, name );
+ (void)Create( parent, id, title, pos, size, style, name );
}
bool wxDialog::Create( wxWindow *parent,
{
SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG);
+ // all dialogs should have tab traversal enabled
+ style |= wxTAB_TRAVERSAL;
+
return wxTopLevelWindow::Create(parent, id, title, pos, size, style, name);
}
void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) )
{
- if (Validate()) TransferDataFromWindow();
+ if (Validate())
+ TransferDataFromWindow();
}
void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
// event tables
// ----------------------------------------------------------------------------
-#ifndef __WXUNIVERSAL__
- IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow, wxWindow)
-#endif
-
// ----------------------------------------------------------------------------
// data
// ----------------------------------------------------------------------------
/* All this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. Not tested. */
- gdk_window_set_decorations(win->m_widget->window,
+ gdk_window_set_decorations(win->m_widget->window,
(GdkWMDecoration)win->m_gdkDecor);
- gdk_window_set_functions(win->m_widget->window,
+ gdk_window_set_functions(win->m_widget->window,
(GdkWMFunction)win->m_gdkFunc);
/* GTK's shrinking/growing policy */
if (style & wxFRAME_TOOL_WINDOW)
win_type = GTK_WINDOW_POPUP;
-
+
if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
win_type = GTK_WINDOW_DIALOG;
{
m_gdkDecor = (long) GDK_DECOR_BORDER;
m_gdkFunc = (long) GDK_FUNC_MOVE;
-
+
// All this is for Motif Window Manager "hints" and is supposed to be
- // recognized by other WM as well. Not tested.
+ // recognized by other WM as well. Not tested.
if ((style & wxCAPTION) != 0)
m_gdkDecor |= GDK_DECOR_TITLE;
if ((style & wxSYSTEM_MENU) != 0)
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
- DoSetSize(-1, -1,
+ DoSetSize(-1, -1,
width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0);
}
void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
- int width, int height )
+ int width, int height )
{
// due to a bug in gtk, x,y are always 0
// m_x = x;
long style, const wxString &name )
{
Init();
-
- // all dialogs should have tab traversal enabled
- style |= wxTAB_TRAVERSAL;
- Create( parent, id, title, pos, size, style, name );
+ (void)Create( parent, id, title, pos, size, style, name );
}
bool wxDialog::Create( wxWindow *parent,
{
SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG);
+ // all dialogs should have tab traversal enabled
+ style |= wxTAB_TRAVERSAL;
+
return wxTopLevelWindow::Create(parent, id, title, pos, size, style, name);
}
void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) )
{
- if (Validate()) TransferDataFromWindow();
+ if (Validate())
+ TransferDataFromWindow();
}
void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
// event tables
// ----------------------------------------------------------------------------
-#ifndef __WXUNIVERSAL__
- IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow, wxWindow)
-#endif
-
// ----------------------------------------------------------------------------
// data
// ----------------------------------------------------------------------------
/* All this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. Not tested. */
- gdk_window_set_decorations(win->m_widget->window,
+ gdk_window_set_decorations(win->m_widget->window,
(GdkWMDecoration)win->m_gdkDecor);
- gdk_window_set_functions(win->m_widget->window,
+ gdk_window_set_functions(win->m_widget->window,
(GdkWMFunction)win->m_gdkFunc);
/* GTK's shrinking/growing policy */
if (style & wxFRAME_TOOL_WINDOW)
win_type = GTK_WINDOW_POPUP;
-
+
if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
win_type = GTK_WINDOW_DIALOG;
{
m_gdkDecor = (long) GDK_DECOR_BORDER;
m_gdkFunc = (long) GDK_FUNC_MOVE;
-
+
// All this is for Motif Window Manager "hints" and is supposed to be
- // recognized by other WM as well. Not tested.
+ // recognized by other WM as well. Not tested.
if ((style & wxCAPTION) != 0)
m_gdkDecor |= GDK_DECOR_TITLE;
if ((style & wxSYSTEM_MENU) != 0)
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
- DoSetSize(-1, -1,
+ DoSetSize(-1, -1,
width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0);
}
void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
- int width, int height )
+ int width, int height )
{
// due to a bug in gtk, x,y are always 0
// m_x = x;
// globals
// ----------------------------------------------------------------------------
-// all objects to be deleted during next idle processing - from window.cpp
-extern wxList WXDLLEXPORT wxPendingDelete;
-
-// all frames and modeless dialogs - not static, used in frame.cpp, mdi.cpp &c
-wxWindowList wxModelessWindows;
-
// all modal dialogs currently shown
static wxWindowList wxModalDialogs;
// wxWin macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
+IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
-BEGIN_EVENT_TABLE(wxDialog, wxPanel)
+BEGIN_EVENT_TABLE(wxDialog, wxTopLevelWindow)
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
{
Init();
- m_oldFocus = FindFocus();
-
- SetName(name);
+ SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG);
- wxTopLevelWindows.Append(this);
-
- if ( parent )
- parent->AddChild(this);
+ if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
+ return FALSE;
- if ( id == -1 )
- m_windowId = (int)NewControlId();
- else
- m_windowId = id;
+ m_oldFocus = FindFocus();
int x = pos.x;
int y = pos.y;
if (y < 0)
y = wxDIALOG_DEFAULT_Y;
- m_windowStyle = style;
-
if (width < 0)
width = wxDIALOG_DEFAULT_WIDTH;
if (height < 0)
#ifdef __WXMICROWIN__
extern const wxChar *wxFrameClassName;
-
+
int msflags = WS_OVERLAPPED|WS_POPUP;
if (style & wxCAPTION)
msflags |= WS_CAPTION;
#ifndef __WXMICROWIN__
SubclassWin(GetHWND());
#endif
-
+
SetWindowText(hwnd, title);
return TRUE;
wxLogLastError(_T("DrawMenuBar"));
}
#endif
-
+
return TRUE;
}
{
m_isBeingDeleted = TRUE;
- wxTopLevelWindows.DeleteObject(this);
-
// this will also reenable all the other windows for a modal dialog
Show(FALSE);
-
- if ( !IsModal() )
- wxModelessWindows.DeleteObject(this);
-
- // If this is the last top-level window, exit.
- if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
- {
- wxTheApp->SetTopWindow(NULL);
-
- if ( wxTheApp->GetExitOnFrameDelete() )
- {
- ::PostQuitMessage(0);
- }
- }
}
// ----------------------------------------------------------------------------
event.Skip();
}
-// ----------------------------------------------------------------------------
-// Windows dialog boxes can't be iconized
-// ----------------------------------------------------------------------------
-
-void wxDialog::Iconize(bool WXUNUSED(iconize))
-{
-}
-
-bool wxDialog::IsIconized() const
-{
- return FALSE;
-}
-
-// ----------------------------------------------------------------------------
-// size/position handling
-// ----------------------------------------------------------------------------
-
-void wxDialog::DoSetClientSize(int width, int height)
-{
- HWND hWnd = (HWND) GetHWND();
- RECT rect;
- ::GetClientRect(hWnd, &rect);
-
- RECT rect2;
- GetWindowRect(hWnd, &rect2);
-
- // Find the difference between the entire window (title bar and all)
- // and the client area; add this to the new client size to move the
- // window
- int actual_width = rect2.right - rect2.left - rect.right + width;
- int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
-
- MoveWindow(hWnd, rect2.left, rect2.top, actual_width, actual_height, TRUE);
-
- wxSizeEvent event(wxSize(actual_width, actual_height), m_windowId);
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent(event);
-}
-
-void wxDialog::DoGetPosition(int *x, int *y) const
-{
- RECT rect;
- GetWindowRect(GetHwnd(), &rect);
-
- if ( x )
- *x = rect.left;
- if ( y )
- *y = rect.top;
-}
-
// ----------------------------------------------------------------------------
// showing the dialogs
// ----------------------------------------------------------------------------
closing.DeleteObject(this);
}
-// Destroy the window (delayed, if a managed window)
-bool wxDialog::Destroy()
-{
- wxCHECK_MSG( !wxPendingDelete.Member(this), FALSE,
- _T("wxDialog destroyed twice") );
-
- wxPendingDelete.Append(this);
-
- return TRUE;
-}
-
void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
{
#if wxUSE_CTL3D
rc = FALSE;
}
break;
-#endif
+#endif // __WXMICROWIN__
}
if ( !processed )
// globals
// ----------------------------------------------------------------------------
-extern wxWindowList wxModelessWindows;
extern const wxChar *wxFrameClassName;
#if wxUSE_MENUS_NATIVE
void wxFrameMSW::Init()
{
- m_iconized =
- m_maximizeOnShow = FALSE;
-
#if wxUSE_TOOLTIPS
m_hwndToolTip = 0;
#endif
long style,
const wxString& name)
{
- SetName(name);
- m_windowStyle = style;
-
- SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
-
- if ( id > -1 )
- m_windowId = id;
- else
- m_windowId = (int)NewControlId();
-
- if (parent) parent->AddChild(this);
-
- int x = pos.x;
- int y = pos.y;
- int width = size.x;
- int height = size.y;
-
- m_iconized = FALSE;
+ if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
+ return FALSE;
- wxTopLevelWindows.Append(this);
+ // the frame must have NULL parent HWND or it would be always on top of its
+ // parent which is not what we usually want (in fact, we only want it for
+ // frames with the special wxFRAME_TOOL_WINDOW style handled elsewhere)
+ if ( !MSWCreate(m_windowId, NULL, wxFrameClassName, this, title,
+ pos.x, pos.y, size.x, size.y, style) )
+ return FALSE;
- // the frame must have NULL parent HWND or it would be always on top of its
- // parent which is not what we usually want (in fact, we only want it for
- // frames with the special wxFRAME_TOOL_WINDOW style handled elsewhere)
- MSWCreate(m_windowId, NULL, wxFrameClassName, this, title,
- x, y, width, height, style);
+ SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
- wxModelessWindows.Append(this);
+ wxModelessWindows.Append(this);
- return TRUE;
+ return TRUE;
}
wxFrameMSW::~wxFrameMSW()
{
- m_isBeingDeleted = TRUE;
- wxTopLevelWindows.DeleteObject(this);
-
- // the ~wxToolBar() code relies on the previous line to be executed before
- // this one, i.e. the frame should remove itself from wxTopLevelWindows
- // before destorying its toolbar
- DeleteAllBars();
+ m_isBeingDeleted = TRUE;
- if (wxTheApp && (wxTopLevelWindows.Number() == 0))
- {
- wxTheApp->SetTopWindow(NULL);
-
- if (wxTheApp->GetExitOnFrameDelete())
- {
- PostQuitMessage(0);
- }
- }
-
- wxModelessWindows.DeleteObject(this);
-
- // For some reason, wxWindows can activate another task altogether
- // when a frame is destroyed after a modal dialog has been invoked.
- // Try to bring the parent to the top.
- // MT:Only do this if this frame is currently the active window, else weird
- // things start to happen
- if ( wxGetActiveWindow() == this )
- if (GetParent() && GetParent()->GetHWND())
- ::BringWindowToTop((HWND) GetParent()->GetHWND());
+ DeleteAllBars();
}
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
*y = rect.bottom;
}
-// Set the client size (i.e. leave the calculation of borders etc.
-// to wxWindows)
void wxFrameMSW::DoSetClientSize(int width, int height)
{
- HWND hWnd = GetHwnd();
-
- RECT rectClient;
- ::GetClientRect(hWnd, &rectClient);
-
- RECT rectTotal;
- ::GetWindowRect(hWnd, &rectTotal);
-
- // Find the difference between the entire window (title bar and all)
- // and the client area; add this to the new client size to move the
- // window
- width += rectTotal.right - rectTotal.left - rectClient.right;
- height += rectTotal.bottom - rectTotal.top - rectClient.bottom;
-
+ // leave enough space for the status bar if we have (and show) it
#if wxUSE_STATUSBAR
wxStatusBar *statbar = GetStatusBar();
if ( statbar && statbar->IsShown() )
{
- // leave enough space for the status bar
height += statbar->GetSize().y;
}
#endif // wxUSE_STATUSBAR
- // note that this takes the toolbar into account
- wxPoint pt = GetClientAreaOrigin();
- width += pt.x;
- height += pt.y;
-
- if ( !::MoveWindow(hWnd, rectTotal.left, rectTotal.top,
- width, height, TRUE /* redraw */) )
- {
- wxLogLastError(_T("MoveWindow"));
- }
-
- wxSizeEvent event(wxSize(width, height), m_windowId);
- event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
-}
-
-void wxFrameMSW::DoGetSize(int *width, int *height) const
-{
- RECT rect;
- ::GetWindowRect(GetHwnd(), &rect);
-
- *width = rect.right - rect.left;
- *height = rect.bottom - rect.top;
-}
-
-void wxFrameMSW::DoGetPosition(int *x, int *y) const
-{
- RECT rect;
- ::GetWindowRect(GetHwnd(), &rect);
-
- *x = rect.left;
- *y = rect.top;
+ wxTopLevelWindow::DoSetClientSize(width, height);
}
// ----------------------------------------------------------------------------
-// variations around ::ShowWindow()
+// wxFrameMSW: various geometry-related functions
// ----------------------------------------------------------------------------
-void wxFrameMSW::DoShowWindow(int nShowCmd)
-{
- ::ShowWindow(GetHwnd(), nShowCmd);
-
- m_iconized = nShowCmd == SW_MINIMIZE;
-}
-
-bool wxFrameMSW::Show(bool show)
-{
- // don't use wxWindow version as we want to call DoShowWindow()
- if ( !wxWindowBase::Show(show) )
- return FALSE;
-
- int nShowCmd;
- if ( show )
- {
- if ( m_maximizeOnShow )
- {
- // show and maximize
- nShowCmd = SW_MAXIMIZE;
-
- m_maximizeOnShow = FALSE;
- }
- else // just show
- {
- nShowCmd = SW_SHOW;
- }
- }
- else // hide
- {
- nShowCmd = SW_HIDE;
- }
-
- DoShowWindow(nShowCmd);
-
- if ( show )
- {
- ::BringWindowToTop(GetHwnd());
-
- wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent(event);
- }
- else // hide
- {
- // Try to highlight the correct window (the parent)
- if ( GetParent() )
- {
- HWND hWndParent = GetHwndOf(GetParent());
- if (hWndParent)
- ::BringWindowToTop(hWndParent);
- }
- }
-
- return TRUE;
-}
-
void wxFrameMSW::Raise()
{
#ifdef __WIN16__
#endif // Win16/32
}
-void wxFrameMSW::Iconize(bool iconize)
-{
- DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
-}
-
-void wxFrameMSW::Maximize(bool maximize)
-{
- if ( IsShown() )
- {
- // just maximize it directly
- DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE);
- }
- else // hidden
- {
- // we can't maximize the hidden frame because it shows it as well, so
- // just remember that we should do it later in this case
- m_maximizeOnShow = TRUE;
- }
-}
-
-void wxFrameMSW::Restore()
-{
- DoShowWindow(SW_RESTORE);
-}
-
-bool wxFrameMSW::IsIconized() const
-{
-#ifdef __WXMICROWIN__
- // TODO
- return FALSE;
-#else
- ((wxFrameMSW *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
- return m_iconized;
-#endif
-}
-
-// Is it maximized?
-bool wxFrameMSW::IsMaximized() const
-{
-#ifdef __WXMICROWIN__
- // TODO
- return FALSE;
-#else
- return (::IsZoomed(GetHwnd()) != 0);
-#endif
-}
-
-void wxFrameMSW::SetIcon(const wxIcon& icon)
-{
- wxFrameBase::SetIcon(icon);
-
-#if defined(__WIN95__) && !defined(__WXMICROWIN__)
- if ( m_icon.Ok() )
- {
- SendMessage(GetHwnd(), WM_SETICON,
- (WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON());
- }
-#endif // __WIN95__
-}
-
// generate an artificial resize event
void wxFrameMSW::SendSizeEvent()
{
- RECT r;
-#ifdef __WIN16__
- ::GetWindowRect(GetHwnd(), &r);
-#else
- if ( !::GetWindowRect(GetHwnd(), &r) )
- {
- wxLogLastError(_T("GetWindowRect"));
- }
-#endif
-
if ( !m_iconized )
{
+ RECT r = wxGetWindowRect(GetHwnd());
+
(void)::PostMessage(GetHwnd(), WM_SIZE,
IsMaximized() ? SIZE_MAXIMIZED : SIZE_RESTORED,
MAKELPARAM(r.right - r.left, r.bottom - r.top));
newStyle &= (~offFlags);
// change our window style to be compatible with full-screen mode
- SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle);
+ ::SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle);
// resize to the size of the desktop
int width, height;
- RECT rect;
- ::GetWindowRect(GetDesktopWindow(), &rect);
+ RECT rect = wxGetWindowRect(::GetDesktopWindow());
width = rect.right - rect.left;
height = rect.bottom - rect.top;
int x, int y, int width, int height, long style)
{
- m_defaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON);
-
// If child windows aren't properly drawn initially, WS_CLIPCHILDREN
// could be the culprit. But without it, you can get a lot of flicker.
}
}
+WXHICON wxFrameMSW::GetDefaultIcon() const
+{
+ return (WXHICON)(wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON
+ : wxDEFAULT_FRAME_ICON);
+}
+
// ===========================================================================
// message processing
// ===========================================================================
if ( m_iconized )
{
HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
- : (HICON)m_defaultIcon;
+ : (HICON)GetDefaultIcon();
// Hold a pointer to the dc so long as the OnPaint() message
// is being processed
case WM_QUERYDRAGICON:
{
HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
- : (HICON)(m_defaultIcon);
+ : (HICON)GetDefaultIcon();
rc = (long)hIcon;
processed = rc != 0;
}
long style,
const wxString& name)
{
- m_defaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON
- ? wxSTD_MDIPARENTFRAME_ICON
- : wxDEFAULT_MDIPARENTFRAME_ICON);
-
m_clientWindow = NULL;
m_currentChild = NULL;
event.Skip();
}
+WXHICON wxMDIParentFrame::GetDefaultIcon() const
+{
+ return (WXHICON)(wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON
+ : wxDEFAULT_MDIPARENTFRAME_ICON);
+}
+
// ---------------------------------------------------------------------------
// MDI operations
// ---------------------------------------------------------------------------
long style,
const wxString& name)
{
- m_defaultIcon = (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON
- : wxDEFAULT_MDICHILDFRAME_ICON);
-
SetName(name);
wxWindowBase::Show(TRUE); // MDI child frame starts off shown
parent->m_parentFrameActive = FALSE;
}
+WXHICON wxMDIChildFrame::GetDefaultIcon() const
+{
+ return (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON
+ : wxDEFAULT_MDICHILDFRAME_ICON);
+}
+
// ---------------------------------------------------------------------------
// MDI operations
// ---------------------------------------------------------------------------
}
}
-static wxToolBarToolBase *GetItemSkippingDummySpacers( const wxToolBarToolsList& tools, size_t index )
+static
+wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
+ size_t index )
{
wxToolBarToolsList::Node* current = tools.GetFirst();
- for( ; current != 0; current = current->GetNext() )
+ for ( ; current != 0; current = current->GetNext() )
{
- if( index == 0 )
+ if ( index == 0 )
return current->GetData();
- size_t separators = ((wxToolBarTool*)current->GetData())->GetSeparatorsCount();
- // if it is a normal button, sepcount == 0, so skip 1
- // item ( the button )
- // otherwise, skip as many items as the separator count,
- // plus the control itself
- index -= separators ? separators + 1: 1;
+
+ wxToolBarTool *tool = (wxToolBarTool *)current->GetData();
+ size_t separators = tool->GetSeparatorsCount();
+
+ // if it is a normal button, sepcount == 0, so skip 1 item (the button)
+ // otherwise, skip as many items as the separator count, plus the
+ // control itself
+ index -= separators ? separators + 1 : 1;
}
return 0;
return (wxToolBarToolBase *)NULL;
}
- // if comctl32 version < 4.71
- // wxToolBar95 adds dummy spacers
+ // if comctl32 version < 4.71 wxToolBar95 adds dummy spacers
#if defined(_WIN32_IE) && (_WIN32_IE >= 0x400 )
if ( wxTheApp->GetComCtl32Version() >= 471 )
{
return m_tools.Item((size_t)index)->GetData();
}
else
+#endif
{
return GetItemSkippingDummySpacers( m_tools, (size_t) index );
}
-#else
- return GetItemSkippingDummySpacers( m_tools, (size_t) index );
-#endif
}
void wxToolBar::UpdateSize()
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: msw/toplevel.cpp
+// Purpose: implements wxTopLevelWindow for MSW
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 24.09.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
+// License: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "toplevel.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/string.h"
+ #include "wx/log.h"
+ #include "wx/intl.h"
+#endif //WX_PRECOMP
+
+#include "wx/msw/private.h"
+
+// ----------------------------------------------------------------------------
+// stubs for missing functions under MicroWindows
+// ----------------------------------------------------------------------------
+
+#ifdef __WXMICROWIN__
+
+static inline bool IsIconic(HWND WXUNUSED(hwnd)) { return FALSE; }
+static inline bool IsZoomed(HWND WXUNUSED(hwnd)) { return FALSE; }
+
+#endif // __WXMICROWIN__
+
+// ----------------------------------------------------------------------------
+// globals
+// ----------------------------------------------------------------------------
+
+// list of all frames and modeless dialogs
+wxWindowList wxModelessWindows;
+
+// ============================================================================
+// wxTopLevelWindowMSW implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW creation
+// ----------------------------------------------------------------------------
+
+void wxTopLevelWindowMSW::Init()
+{
+ m_iconized =
+ m_maximizeOnShow = FALSE;
+}
+
+bool wxTopLevelWindowMSW::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+{
+ // init our fields
+ Init();
+
+ m_windowStyle = style;
+
+ SetName(name);
+
+ m_windowId = id == -1 ? NewControlId() : id;
+
+ wxTopLevelWindows.Append(this);
+
+ if ( parent )
+ parent->AddChild(this);
+
+ return TRUE;
+}
+
+wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
+{
+ wxTopLevelWindows.DeleteObject(this);
+
+ if ( wxModelessWindows.Find(this) )
+ wxModelessWindows.DeleteObject(this);
+
+ // If this is the last top-level window, exit.
+ if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
+ {
+ wxTheApp->SetTopWindow(NULL);
+
+ if ( wxTheApp->GetExitOnFrameDelete() )
+ {
+ ::PostQuitMessage(0);
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW geometry
+// ----------------------------------------------------------------------------
+
+void wxTopLevelWindowMSW::DoSetClientSize(int width, int height)
+{
+ HWND hWnd = GetHwnd();
+
+ RECT rectClient;
+ ::GetClientRect(hWnd, &rectClient);
+
+ RECT rectTotal;
+ ::GetWindowRect(hWnd, &rectTotal);
+
+ // Find the difference between the entire window (title bar and all)
+ // and the client area; add this to the new client size to move the
+ // window
+ width += rectTotal.right - rectTotal.left - rectClient.right;
+ height += rectTotal.bottom - rectTotal.top - rectClient.bottom;
+
+ // note that calling GetClientAreaOrigin() takes the toolbar into account
+ wxPoint pt = GetClientAreaOrigin();
+ width += pt.x;
+ height += pt.y;
+
+ if ( !::MoveWindow(hWnd, rectTotal.left, rectTotal.top,
+ width, height, TRUE /* redraw */) )
+ {
+ wxLogLastError(_T("MoveWindow"));
+ }
+
+ wxSizeEvent event(wxSize(width, height), m_windowId);
+ event.SetEventObject(this);
+ (void)GetEventHandler()->ProcessEvent(event);
+}
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW showing
+// ----------------------------------------------------------------------------
+
+void wxTopLevelWindowMSW::DoShowWindow(int nShowCmd)
+{
+ ::ShowWindow(GetHwnd(), nShowCmd);
+
+ m_iconized = nShowCmd == SW_MINIMIZE;
+}
+
+bool wxTopLevelWindowMSW::Show(bool show)
+{
+ // don't use wxWindow version as we want to call DoShowWindow() ourselves
+ if ( !wxWindowBase::Show(show) )
+ return FALSE;
+
+ int nShowCmd;
+ if ( show )
+ {
+ if ( m_maximizeOnShow )
+ {
+ // show and maximize
+ nShowCmd = SW_MAXIMIZE;
+
+ m_maximizeOnShow = FALSE;
+ }
+ else // just show
+ {
+ nShowCmd = SW_SHOW;
+ }
+ }
+ else // hide
+ {
+ nShowCmd = SW_HIDE;
+ }
+
+ DoShowWindow(nShowCmd);
+
+ if ( show )
+ {
+ ::BringWindowToTop(GetHwnd());
+
+ wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent(event);
+ }
+ else // hide
+ {
+ // Try to highlight the correct window (the parent)
+ if ( GetParent() )
+ {
+ HWND hWndParent = GetHwndOf(GetParent());
+ if (hWndParent)
+ ::BringWindowToTop(hWndParent);
+ }
+ }
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW maximize/minimize
+// ----------------------------------------------------------------------------
+
+void wxTopLevelWindowMSW::Maximize(bool maximize)
+{
+ if ( IsShown() )
+ {
+ // just maximize it directly
+ DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE);
+ }
+ else // hidden
+ {
+ // we can't maximize the hidden frame because it shows it as well, so
+ // just remember that we should do it later in this case
+ m_maximizeOnShow = TRUE;
+ }
+}
+
+bool wxTopLevelWindowMSW::IsMaximized() const
+{
+ return ::IsZoomed(GetHwnd()) != 0;
+}
+
+void wxTopLevelWindowMSW::Iconize(bool iconize)
+{
+ DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
+}
+
+bool wxTopLevelWindowMSW::IsIconized() const
+{
+ // also update the current state
+ ((wxTopLevelWindowMSW *)this)->m_iconized = ::IsIconic(GetHwnd()) != 0;
+
+ return m_iconized;
+}
+
+void wxTopLevelWindowMSW::Restore()
+{
+ DoShowWindow(SW_RESTORE);
+}
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW misc
+// ----------------------------------------------------------------------------
+
+void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon)
+{
+ // this sets m_icon
+ wxTopLevelWindowBase::SetIcon(icon);
+
+#if defined(__WIN95__) && !defined(__WXMICROWIN__)
+ if ( m_icon.Ok() )
+ {
+ ::SendMessage(GetHwnd(), WM_SETICON,
+ (WPARAM)TRUE, (LPARAM)GetHiconOf(m_icon));
+ }
+#endif // __WIN95__
+}
POINT point;
::GetCursorPos(&point);
- RECT rect;
- ::GetWindowRect(hWnd, &rect);
+ RECT rect = wxGetWindowRect(hWnd);
if ( ::PtInRect(&rect, point) && !wxIsBusy() )
::SetCursor(GetHcursorOf(m_cursor));
// we need to have client coordinates here for symmetry with
// wxEVT_ENTER_WINDOW
- RECT rect;
- if ( !::GetWindowRect(GetHwnd(), &rect) )
- {
- wxLogLastError(_T("GetWindowRect"));
- }
+ RECT rect = wxGetWindowRect(GetHwnd());
pt.x -= rect.left;
pt.y -= rect.top;
// Get total size
void wxWindowMSW::DoGetSize(int *x, int *y) const
{
- HWND hWnd = GetHwnd();
- RECT rect;
-#ifdef __WIN16__
- ::GetWindowRect(hWnd, &rect);
-#else
- if ( !::GetWindowRect(hWnd, &rect) )
- {
- wxLogLastError(_T("GetWindowRect"));
- }
-#endif
+ RECT rect = wxGetWindowRect(GetHwnd());
+
if ( x )
*x = rect.right - rect.left;
if ( y )
*y = rect.bottom - rect.top;
}
-void wxWindowMSW::DoGetPosition(int *x, int *y) const
+// Get size *available for subwindows* i.e. excluding menu bar etc.
+void wxWindowMSW::DoGetClientSize(int *x, int *y) const
{
- HWND hWnd = GetHwnd();
+ RECT rect = wxGetClientRect(GetHwnd());
- RECT rect;
- GetWindowRect(hWnd, &rect);
+ if ( x )
+ *x = rect.right;
+ if ( y )
+ *y = rect.bottom;
+}
+
+void wxWindowMSW::DoGetPosition(int *x, int *y) const
+{
+ RECT rect = wxGetWindowRect(GetHwnd());
POINT point;
point.x = rect.left;
if ( y )
pt.y = *y;
- HWND hWnd = GetHwnd();
- ::ScreenToClient(hWnd, &pt);
+ ::ScreenToClient(GetHwnd(), &pt);
if ( x )
*x = pt.x;
if ( y )
pt.y = *y;
- HWND hWnd = GetHwnd();
- ::ClientToScreen(hWnd, &pt);
+ ::ClientToScreen(GetHwnd(), &pt);
if ( x )
*x = pt.x;
*y = pt.y;
}
-// Get size *available for subwindows* i.e. excluding menu bar etc.
-void wxWindowMSW::DoGetClientSize(int *x, int *y) const
-{
- HWND hWnd = GetHwnd();
- RECT rect;
- ::GetClientRect(hWnd, &rect);
- if ( x )
- *x = rect.right;
- if ( y )
- *y = rect.bottom;
-}
-
void wxWindowMSW::DoMoveWindow(int x, int y, int width, int height)
{
if ( !::MoveWindow(GetHwnd(), x, y, width, height, TRUE) )
// event tables
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTopLevelWindow, wxWindow)
-
BEGIN_EVENT_TABLE(wxTopLevelWindow, wxTopLevelWindowNative)
EVT_NC_PAINT(wxTopLevelWindow::OnNcPaint)
END_EVENT_TABLE()