temp [non] fix for wxTLW [non] creation under wxMSW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -45,7 +45,6 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
WX_FORWARD_TO_INPUT_CONSUMER(wxTopLevelWindow)
|
WX_FORWARD_TO_INPUT_CONSUMER(wxTopLevelWindow)
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -63,7 +62,7 @@ bool wxTopLevelWindow::Create(wxWindow *parent,
|
|||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& sizeOrig,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString &name)
|
const wxString &name)
|
||||||
{
|
{
|
||||||
@@ -82,31 +81,40 @@ bool wxTopLevelWindow::Create(wxWindow *parent,
|
|||||||
|
|
||||||
styleOrig = style;
|
styleOrig = style;
|
||||||
exstyleOrig = GetExtraStyle();
|
exstyleOrig = GetExtraStyle();
|
||||||
style &= ~(wxCAPTION | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
|
style &= ~(wxCAPTION | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
|
||||||
wxSYSTEM_MENU | wxRESIZE_BORDER | wxFRAME_TOOL_WINDOW |
|
wxSYSTEM_MENU | wxRESIZE_BORDER | wxFRAME_TOOL_WINDOW |
|
||||||
wxTHICK_FRAME);
|
wxTHICK_FRAME);
|
||||||
style = wxSIMPLE_BORDER;
|
style = wxSIMPLE_BORDER;
|
||||||
SetExtraStyle(exstyleOrig &
|
SetExtraStyle(exstyleOrig &
|
||||||
~(wxFRAME_EX_CONTEXTHELP | wxDIALOG_EX_CONTEXTHELP));
|
~(wxFRAME_EX_CONTEXTHELP | wxDIALOG_EX_CONTEXTHELP));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !wxTopLevelWindowNative::Create(parent, id, title, pos,
|
if ( !wxTopLevelWindowNative::Create(parent, id, title, pos,
|
||||||
sizeOrig, style, name) )
|
size, style, name) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
// FIXME: to be removed as soon as wxTLW/wxFrame/wxDialog creation code in
|
||||||
|
// wxMSW is rationalized
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
extern const wxChar *wxFrameClassName;
|
||||||
|
if ( !MSWCreate(id, NULL, wxFrameClassName, this, title,
|
||||||
|
pos.x, pos.y, size.x, size.y, style) )
|
||||||
|
return FALSE;
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
if ( ms_drawDecorations )
|
if ( ms_drawDecorations )
|
||||||
{
|
{
|
||||||
m_windowStyle = styleOrig;
|
m_windowStyle = styleOrig;
|
||||||
m_exStyle = exstyleOrig;
|
m_exStyle = exstyleOrig;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTopLevelWindow::ShowFullScreen(bool show, long style)
|
bool wxTopLevelWindow::ShowFullScreen(bool show, long style)
|
||||||
{
|
{
|
||||||
if ( show == IsFullScreen() ) return FALSE;
|
if ( show == IsFullScreen() ) return FALSE;
|
||||||
|
|
||||||
if ( ms_drawDecorations )
|
if ( ms_drawDecorations )
|
||||||
{
|
{
|
||||||
if ( show )
|
if ( show )
|
||||||
@@ -146,7 +154,7 @@ long wxTopLevelWindow::GetDecorationsStyle() const
|
|||||||
style |= wxTOPLEVEL_BORDER;
|
style |= wxTOPLEVEL_BORDER;
|
||||||
if ( m_windowStyle & (wxRESIZE_BORDER | wxTHICK_FRAME) )
|
if ( m_windowStyle & (wxRESIZE_BORDER | wxTHICK_FRAME) )
|
||||||
style |= wxTOPLEVEL_RESIZEABLE;
|
style |= wxTOPLEVEL_RESIZEABLE;
|
||||||
|
|
||||||
if ( IsMaximized() )
|
if ( IsMaximized() )
|
||||||
style |= wxTOPLEVEL_MAXIMIZED;
|
style |= wxTOPLEVEL_MAXIMIZED;
|
||||||
if ( GetIcon().Ok() )
|
if ( GetIcon().Ok() )
|
||||||
@@ -176,7 +184,7 @@ wxPoint wxTopLevelWindow::GetClientAreaOrigin() const
|
|||||||
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
|
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
|
||||||
wxRect rect = wxRect(wxTopLevelWindowNative::GetClientAreaOrigin(),
|
wxRect rect = wxRect(wxTopLevelWindowNative::GetClientAreaOrigin(),
|
||||||
wxSize(w, h));
|
wxSize(w, h));
|
||||||
rect = m_renderer->GetFrameClientArea(rect,
|
rect = m_renderer->GetFrameClientArea(rect,
|
||||||
GetDecorationsStyle());
|
GetDecorationsStyle());
|
||||||
return rect.GetPosition();
|
return rect.GetPosition();
|
||||||
}
|
}
|
||||||
@@ -194,7 +202,7 @@ void wxTopLevelWindow::DoGetClientSize(int *width, int *height) const
|
|||||||
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
|
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
|
||||||
wxRect rect = wxRect(wxTopLevelWindowNative::GetClientAreaOrigin(),
|
wxRect rect = wxRect(wxTopLevelWindowNative::GetClientAreaOrigin(),
|
||||||
wxSize(w, h));
|
wxSize(w, h));
|
||||||
rect = m_renderer->GetFrameClientArea(rect,
|
rect = m_renderer->GetFrameClientArea(rect,
|
||||||
GetDecorationsStyle());
|
GetDecorationsStyle());
|
||||||
if ( width )
|
if ( width )
|
||||||
*width = rect.width;
|
*width = rect.width;
|
||||||
@@ -209,7 +217,7 @@ void wxTopLevelWindow::DoSetClientSize(int width, int height)
|
|||||||
{
|
{
|
||||||
if ( ms_drawDecorations )
|
if ( ms_drawDecorations )
|
||||||
{
|
{
|
||||||
wxSize size = m_renderer->GetFrameTotalSize(wxSize(width, height),
|
wxSize size = m_renderer->GetFrameTotalSize(wxSize(width, height),
|
||||||
GetDecorationsStyle());
|
GetDecorationsStyle());
|
||||||
wxTopLevelWindowNative::DoSetClientSize(size.x, size.y);
|
wxTopLevelWindowNative::DoSetClientSize(size.x, size.y);
|
||||||
}
|
}
|
||||||
@@ -232,7 +240,7 @@ void wxTopLevelWindow::OnNcPaint(wxPaintEvent& event)
|
|||||||
rect.height = size.y;
|
rect.height = size.y;
|
||||||
|
|
||||||
wxWindowDC dc(this);
|
wxWindowDC dc(this);
|
||||||
m_renderer->DrawFrameTitleBar(dc, rect,
|
m_renderer->DrawFrameTitleBar(dc, rect,
|
||||||
GetTitle(), m_titlebarIcon,
|
GetTitle(), m_titlebarIcon,
|
||||||
GetDecorationsStyle(),
|
GetDecorationsStyle(),
|
||||||
m_pressedButton,
|
m_pressedButton,
|
||||||
@@ -245,7 +253,7 @@ long wxTopLevelWindow::HitTest(const wxPoint& pt) const
|
|||||||
int w, h;
|
int w, h;
|
||||||
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
|
wxTopLevelWindowNative::DoGetClientSize(&w, &h);
|
||||||
wxRect rect(wxTopLevelWindowNative::GetClientAreaOrigin(), wxSize(w, h));
|
wxRect rect(wxTopLevelWindowNative::GetClientAreaOrigin(), wxSize(w, h));
|
||||||
|
|
||||||
return m_renderer->HitTestFrame(rect, pt, GetDecorationsStyle());
|
return m_renderer->HitTestFrame(rect, pt, GetDecorationsStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +267,7 @@ void wxTopLevelWindow::SetIcon(const wxIcon& icon)
|
|||||||
if ( !m_renderer ) return;
|
if ( !m_renderer ) return;
|
||||||
|
|
||||||
wxSize size = m_renderer->GetFrameIconSize();
|
wxSize size = m_renderer->GetFrameIconSize();
|
||||||
|
|
||||||
if ( !icon.Ok() || size.x == -1 )
|
if ( !icon.Ok() || size.x == -1 )
|
||||||
m_titlebarIcon = icon;
|
m_titlebarIcon = icon;
|
||||||
else
|
else
|
||||||
@@ -310,7 +318,7 @@ void wxTopLevelWindow::ClickTitleBarButton(long button)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG(wxT("incorrect button specification"));
|
wxFAIL_MSG(wxT("incorrect button specification"));
|
||||||
}
|
}
|
||||||
@@ -320,33 +328,35 @@ bool wxTopLevelWindow::PerformAction(const wxControlAction& action,
|
|||||||
long numArg,
|
long numArg,
|
||||||
const wxString& strArg)
|
const wxString& strArg)
|
||||||
{
|
{
|
||||||
|
bool isActive = numArg != 0;
|
||||||
|
|
||||||
if ( action == wxACTION_TOPLEVEL_ACTIVATE )
|
if ( action == wxACTION_TOPLEVEL_ACTIVATE )
|
||||||
{
|
{
|
||||||
if ( m_isActive != (bool)numArg )
|
if ( m_isActive != isActive )
|
||||||
{
|
{
|
||||||
Refresh();
|
Refresh();
|
||||||
m_isActive = (bool)numArg;
|
m_isActive = isActive;
|
||||||
wxNcPaintEvent event(GetId());
|
wxNcPaintEvent event(GetId());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( action == wxACTION_TOPLEVEL_BUTTON_PRESS )
|
else if ( action == wxACTION_TOPLEVEL_BUTTON_PRESS )
|
||||||
{
|
{
|
||||||
m_pressedButton = numArg;
|
m_pressedButton = numArg;
|
||||||
RefreshTitleBar();
|
RefreshTitleBar();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( action == wxACTION_TOPLEVEL_BUTTON_RELEASE )
|
else if ( action == wxACTION_TOPLEVEL_BUTTON_RELEASE )
|
||||||
{
|
{
|
||||||
m_pressedButton = 0;
|
m_pressedButton = 0;
|
||||||
RefreshTitleBar();
|
RefreshTitleBar();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( action == wxACTION_TOPLEVEL_BUTTON_CLICK )
|
else if ( action == wxACTION_TOPLEVEL_BUTTON_CLICK )
|
||||||
{
|
{
|
||||||
m_pressedButton = 0;
|
m_pressedButton = 0;
|
||||||
@@ -354,7 +364,7 @@ bool wxTopLevelWindow::PerformAction(const wxControlAction& action,
|
|||||||
ClickTitleBarButton(numArg);
|
ClickTitleBarButton(numArg);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -389,7 +399,7 @@ bool wxStdFrameInputHandler::HandleMouse(wxInputConsumer *consumer,
|
|||||||
{
|
{
|
||||||
wxTopLevelWindow *w = wxStaticCast(consumer->GetInputWindow(), wxTopLevelWindow);
|
wxTopLevelWindow *w = wxStaticCast(consumer->GetInputWindow(), wxTopLevelWindow);
|
||||||
long hit = w->HitTest(event.GetPosition());
|
long hit = w->HitTest(event.GetPosition());
|
||||||
|
|
||||||
if ( hit & wxHT_TOPLEVEL_ANY_BUTTON )
|
if ( hit & wxHT_TOPLEVEL_ANY_BUTTON )
|
||||||
{
|
{
|
||||||
m_winCapture = w;
|
m_winCapture = w;
|
||||||
@@ -422,7 +432,7 @@ bool wxStdFrameInputHandler::HandleMouse(wxInputConsumer *consumer,
|
|||||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxStdFrameInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
bool wxStdFrameInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||||
const wxMouseEvent& event)
|
const wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
// we only have to do something when the mouse leaves/enters the pressed
|
// we only have to do something when the mouse leaves/enters the pressed
|
||||||
@@ -437,7 +447,7 @@ bool wxStdFrameInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
|||||||
consumer->PerformAction(wxACTION_TOPLEVEL_BUTTON_RELEASE, m_winPressed);
|
consumer->PerformAction(wxACTION_TOPLEVEL_BUTTON_RELEASE, m_winPressed);
|
||||||
else
|
else
|
||||||
consumer->PerformAction(wxACTION_TOPLEVEL_BUTTON_PRESS, m_winPressed);
|
consumer->PerformAction(wxACTION_TOPLEVEL_BUTTON_PRESS, m_winPressed);
|
||||||
|
|
||||||
m_winHitTest = hit;
|
m_winHitTest = hit;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -446,7 +456,7 @@ bool wxStdFrameInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
|||||||
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxStdFrameInputHandler::HandleActivation(wxInputConsumer *consumer,
|
bool wxStdFrameInputHandler::HandleActivation(wxInputConsumer *consumer,
|
||||||
bool activated)
|
bool activated)
|
||||||
{
|
{
|
||||||
consumer->PerformAction(wxACTION_TOPLEVEL_ACTIVATE, activated);
|
consumer->PerformAction(wxACTION_TOPLEVEL_ACTIVATE, activated);
|
||||||
|
Reference in New Issue
Block a user