resizeable dialogs support

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-02-06 23:27:08 +00:00
parent 26f86486b0
commit 462e243784
3 changed files with 169 additions and 159 deletions

View File

@@ -44,25 +44,19 @@ wxList wxModelessWindows; // Frames and modeless dialogs
extern wxList WXDLLEXPORT wxPendingDelete;
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
EVT_SIZE(wxDialog::OnSize)
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
EVT_CHAR_HOOK(wxDialog::OnCharHook)
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
EVT_CLOSE(wxDialog::OnCloseWindow)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
EVT_SIZE(wxDialog::OnSize)
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
EVT_CHAR_HOOK(wxDialog::OnCharHook)
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
EVT_CLOSE(wxDialog::OnCloseWindow)
END_EVENT_TABLE()
#endif
long wxDialog::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
return ::CallWindowProc(CASTWNDPROC m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
}
bool wxDialog::MSWProcessMessage(WXMSG* pMsg)
{
return (::IsDialogMessage((HWND) GetHWND(), (MSG*)pMsg) != 0);
@@ -82,65 +76,80 @@ wxDialog::wxDialog(void)
}
bool wxDialog::Create(wxWindow *parent, wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetName(name);
if (!parent)
wxTopLevelWindows.Append(this);
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetName(name);
if (!parent)
wxTopLevelWindows.Append(this);
// windowFont = wxTheFontList->FindOrCreateFont(11, wxSWISS, wxNORMAL, wxNORMAL);
// windowFont = wxTheFontList->FindOrCreateFont(11, wxSWISS, wxNORMAL, wxNORMAL);
if (parent) parent->AddChild(this);
if (parent) parent->AddChild(this);
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
int x = pos.x;
int y = pos.y;
int width = size.x;
int height = size.y;
int x = pos.x;
int y = pos.y;
int width = size.x;
int height = size.y;
if (x < 0) x = wxDIALOG_DEFAULT_X;
if (y < 0) y = wxDIALOG_DEFAULT_Y;
if (x < 0) x = wxDIALOG_DEFAULT_X;
if (y < 0) y = wxDIALOG_DEFAULT_Y;
m_windowStyle = style;
m_windowStyle = style;
m_isShown = FALSE;
m_modalShowing = FALSE;
m_isShown = FALSE;
m_modalShowing = FALSE;
if (width < 0)
width = 500;
if (height < 0)
height = 500;
if (width < 0)
width = 500;
if (height < 0)
height = 500;
WXDWORD extendedStyle = MakeExtendedStyle(m_windowStyle);
if (m_windowStyle & wxSTAY_ON_TOP)
extendedStyle |= WS_EX_TOPMOST;
WXDWORD extendedStyle = MakeExtendedStyle(m_windowStyle);
if (m_windowStyle & wxSTAY_ON_TOP)
extendedStyle |= WS_EX_TOPMOST;
// Allows creation of dialogs with & without captions under MSWindows
if(style & wxCAPTION){
MSWCreate(m_windowId, (wxWindow *)parent, NULL, this, NULL, x, y, width, height, 0, "wxCaptionDialog",
extendedStyle);
}
else{
MSWCreate(m_windowId, (wxWindow *)parent, NULL, this, NULL, x, y, width, height, 0, "wxNoCaptionDialog",
extendedStyle);
}
// Allows creation of dialogs with & without captions under MSWindows,
// resizeable or not (but a resizeable dialog always has caption -
// otherwise it would look too strange)
const char *dlg;
if ( style & wxTHICK_FRAME )
dlg = "wxResizeableDialog";
else if ( style & wxCAPTION )
dlg = "wxCaptionDialog";
else
dlg = "wxNoCaptionDialog";
MSWCreate(m_windowId, parent, NULL, this, NULL,
x, y, width, height,
0, // style is not used if we have dlg template
dlg,
extendedStyle);
SubclassWin(GetHWND());
HWND hwnd = (HWND)GetHWND();
SetWindowText((HWND) GetHWND(), (const char *)title);
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
if ( !hwnd )
{
wxLogError(_("Failed to created dialog."));
return TRUE;
return FALSE;
}
SubclassWin(GetHWND());
SetWindowText(hwnd, title);
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
return TRUE;
}
void wxDialog::SetModal(bool flag)
@@ -610,10 +619,4 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
Refresh();
#endif
}
long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
return wxWindow::MSWWindowProc(message, wParam, lParam);
}
}