fixed maximization handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -142,18 +142,19 @@ void wxTopLevelWindowMGL::Maximize(bool maximize)
|
|||||||
{
|
{
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
|
||||||
|
m_isMaximized = TRUE;
|
||||||
|
|
||||||
GetPosition(&m_savedFrame.x, &m_savedFrame.y);
|
GetPosition(&m_savedFrame.x, &m_savedFrame.y);
|
||||||
GetSize(&m_savedFrame.width, &m_savedFrame.height);
|
GetSize(&m_savedFrame.width, &m_savedFrame.height);
|
||||||
|
|
||||||
wxClientDisplayRect(&x, &y, &w, &h);
|
wxClientDisplayRect(&x, &y, &w, &h);
|
||||||
SetSize(x, y, w, h);
|
SetSize(x, y, w, h);
|
||||||
m_isMaximized = TRUE;
|
|
||||||
}
|
}
|
||||||
else if ( !maximize && m_isMaximized )
|
else if ( !maximize && m_isMaximized )
|
||||||
{
|
{
|
||||||
|
m_isMaximized = FALSE;
|
||||||
SetSize(m_savedFrame.x, m_savedFrame.y,
|
SetSize(m_savedFrame.x, m_savedFrame.y,
|
||||||
m_savedFrame.width, m_savedFrame.height);
|
m_savedFrame.width, m_savedFrame.height);
|
||||||
m_isMaximized = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -148,7 +148,12 @@ long wxTopLevelWindow::GetDecorationsStyle() const
|
|||||||
if ( m_windowStyle & wxMINIMIZE_BOX )
|
if ( m_windowStyle & wxMINIMIZE_BOX )
|
||||||
style |= wxTOPLEVEL_BUTTON_ICONIZE;
|
style |= wxTOPLEVEL_BUTTON_ICONIZE;
|
||||||
if ( m_windowStyle & wxMAXIMIZE_BOX )
|
if ( m_windowStyle & wxMAXIMIZE_BOX )
|
||||||
style |= wxTOPLEVEL_BUTTON_MAXIMIZE;
|
{
|
||||||
|
if ( IsMaximized() )
|
||||||
|
style |= wxTOPLEVEL_BUTTON_RESTORE;
|
||||||
|
else
|
||||||
|
style |= wxTOPLEVEL_BUTTON_MAXIMIZE;
|
||||||
|
}
|
||||||
#if wxUSE_HELP
|
#if wxUSE_HELP
|
||||||
if ( m_exStyle & (wxFRAME_EX_CONTEXTHELP | wxDIALOG_EX_CONTEXTHELP))
|
if ( m_exStyle & (wxFRAME_EX_CONTEXTHELP | wxDIALOG_EX_CONTEXTHELP))
|
||||||
style |= wxTOPLEVEL_BUTTON_HELP;
|
style |= wxTOPLEVEL_BUTTON_HELP;
|
||||||
@@ -268,25 +273,27 @@ long wxTopLevelWindow::HitTest(const wxPoint& pt) const
|
|||||||
void wxTopLevelWindow::SetIcon(const wxIcon& icon)
|
void wxTopLevelWindow::SetIcon(const wxIcon& icon)
|
||||||
{
|
{
|
||||||
wxTopLevelWindowNative::SetIcon(icon);
|
wxTopLevelWindowNative::SetIcon(icon);
|
||||||
if ( !m_renderer ) return;
|
|
||||||
|
|
||||||
wxSize size = m_renderer->GetFrameIconSize();
|
if ( ms_drawDecorations && m_renderer )
|
||||||
|
|
||||||
if ( !icon.Ok() || size.x == -1 )
|
|
||||||
m_titlebarIcon = icon;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
wxBitmap bmp1;
|
wxSize size = m_renderer->GetFrameIconSize();
|
||||||
bmp1.CopyFromIcon(icon);
|
|
||||||
if ( !bmp1.Ok() )
|
if ( !icon.Ok() || size.x == -1 )
|
||||||
m_titlebarIcon = wxNullIcon;
|
|
||||||
else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y )
|
|
||||||
m_titlebarIcon = icon;
|
m_titlebarIcon = icon;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxImage img = bmp1.ConvertToImage();
|
wxBitmap bmp1;
|
||||||
img.Rescale(size.x, size.y);
|
bmp1.CopyFromIcon(icon);
|
||||||
m_titlebarIcon.CopyFromBitmap(wxBitmap(img));
|
if ( !bmp1.Ok() )
|
||||||
|
m_titlebarIcon = wxNullIcon;
|
||||||
|
else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y )
|
||||||
|
m_titlebarIcon = icon;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxImage img = bmp1.ConvertToImage();
|
||||||
|
img.Rescale(size.x, size.y);
|
||||||
|
m_titlebarIcon.CopyFromBitmap(wxBitmap(img));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user