Added ShowFullScreen
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,6 +32,14 @@ class WXDLLEXPORT wxMenuBar;
|
||||
class WXDLLEXPORT wxStatusBar;
|
||||
class WXDLLEXPORT wxToolBar;
|
||||
|
||||
// Styles for ShowFullScreen
|
||||
#define wxFULLSCREEN_NOMENUBAR 0x01
|
||||
#define wxFULLSCREEN_NOTOOLBAR 0x02
|
||||
#define wxFULLSCREEN_NOSTATUSBAR 0x04
|
||||
#define wxFULLSCREEN_NOBORDER 0x08
|
||||
#define wxFULLSCREEN_NOCAPTION 0x10
|
||||
#define wxFULLSCREEN_ALL (wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFrame is a top-level window with optional menubar, statusbar and toolbar
|
||||
//
|
||||
|
@@ -27,8 +27,9 @@
|
||||
#if !wxUSE_WIN_METAFILES_ALWAYS
|
||||
typedef wxEnhMetaFile wxMetafile;
|
||||
typedef wxEnhMetaFileDC wxMetafileDC;
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
typedef wxEnhMetaFileDataObject wxMetafileDataObject;
|
||||
|
||||
#endif
|
||||
// this flag will be set if wxMetafile class is wxEnhMetaFile
|
||||
#define wxMETAFILE_IS_ENH
|
||||
#endif // wxUSE_WIN_METAFILES_ALWAYS
|
||||
|
@@ -52,6 +52,8 @@ public:
|
||||
virtual void Restore();
|
||||
virtual void SetMenuBar(wxMenuBar *menubar);
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
@@ -147,6 +149,17 @@ protected:
|
||||
static bool m_useNativeStatusBar;
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
// Data to save/restore when calling ShowFullScreen
|
||||
long m_fsStyle; // Passed to ShowFullScreen
|
||||
wxRect m_fsOldSize;
|
||||
long m_fsOldWindowStyle;
|
||||
int m_fsStatusBarFields; // 0 for no status bar
|
||||
int m_fsStatusBarHeight;
|
||||
int m_fsToolBarHeight;
|
||||
// WXHMENU m_fsMenu;
|
||||
bool m_fsIsMaximized;
|
||||
bool m_fsIsShowing;
|
||||
|
||||
private:
|
||||
#if wxUSE_TOOLTIPS
|
||||
WXHWND m_hwndToolTip;
|
||||
|
@@ -56,6 +56,14 @@
|
||||
|
||||
#include <wininet.h>
|
||||
|
||||
// Not in VC++ 5
|
||||
#ifndef INTERNET_CONNECTION_LAN
|
||||
#define INTERNET_CONNECTION_LAN 2
|
||||
#endif
|
||||
#ifndef INTERNET_CONNECTION_PROXY
|
||||
#define INTERNET_CONNECTION_PROXY 4
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -225,6 +225,8 @@ wxEnhMetaFileDC::~wxEnhMetaFileDC()
|
||||
// wxEnhMetaFileDataObject
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
||||
wxDataFormat
|
||||
wxEnhMetaFileDataObject::GetPreferredFormat(Direction WXUNUSED(dir)) const
|
||||
{
|
||||
@@ -376,5 +378,6 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#endif // wxUSE_ENH_METAFILE
|
||||
|
@@ -98,6 +98,16 @@ void wxFrame::Init()
|
||||
#if wxUSE_TOOLTIPS
|
||||
m_hwndToolTip = 0;
|
||||
#endif
|
||||
|
||||
// Data to save/restore when calling ShowFullScreen
|
||||
m_fsStyle = 0;
|
||||
m_fsOldWindowStyle = 0;
|
||||
m_fsStatusBarFields = 0;
|
||||
m_fsStatusBarHeight = 0;
|
||||
m_fsToolBarHeight = 0;
|
||||
// m_fsMenu = 0;
|
||||
m_fsIsMaximized = FALSE;
|
||||
m_fsIsShowing = FALSE;
|
||||
}
|
||||
|
||||
bool wxFrame::Create(wxWindow *parent,
|
||||
@@ -183,7 +193,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
|
||||
::GetClientRect(GetHwnd(), &rect);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
if ( GetStatusBar() )
|
||||
if ( GetStatusBar() && GetStatusBar()->IsShown() )
|
||||
{
|
||||
int statusX, statusY;
|
||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||
@@ -220,7 +230,7 @@ void wxFrame::DoSetClientSize(int width, int height)
|
||||
int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
if ( GetStatusBar() )
|
||||
if ( GetStatusBar() && GetStatusBar()->IsShown())
|
||||
{
|
||||
int statusX, statusY;
|
||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||
@@ -499,6 +509,123 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
wxWindow::OnSysColourChanged(event);
|
||||
}
|
||||
|
||||
// Pass TRUE to show full screen, FALSE to restore.
|
||||
bool wxFrame::ShowFullScreen(bool show, long style)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (IsFullScreen())
|
||||
return FALSE;
|
||||
|
||||
m_fsIsShowing = TRUE;
|
||||
m_fsStyle = style;
|
||||
|
||||
wxToolBar *theToolBar = GetToolBar();
|
||||
wxStatusBar *theStatusBar = GetStatusBar();
|
||||
|
||||
int dummyWidth;
|
||||
|
||||
if (theToolBar)
|
||||
theToolBar->GetSize(&dummyWidth, &m_fsToolBarHeight);
|
||||
if (theStatusBar)
|
||||
theStatusBar->GetSize(&dummyWidth, &m_fsStatusBarHeight);
|
||||
|
||||
// zap the toolbar, menubar, and statusbar
|
||||
|
||||
if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar)
|
||||
{
|
||||
theToolBar->SetSize(-1,0);
|
||||
theToolBar->Show(FALSE);
|
||||
}
|
||||
|
||||
if (style & wxFULLSCREEN_NOMENUBAR)
|
||||
SetMenu((HWND)GetHWND(), (HMENU) NULL);
|
||||
|
||||
// Save the number of fields in the statusbar
|
||||
if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar)
|
||||
{
|
||||
m_fsStatusBarFields = theStatusBar->GetFieldsCount();
|
||||
SetStatusBar((wxStatusBar*) NULL);
|
||||
delete theStatusBar;
|
||||
}
|
||||
else
|
||||
m_fsStatusBarFields = 0;
|
||||
|
||||
// zap the frame borders
|
||||
|
||||
// save the 'normal' window style
|
||||
m_fsOldWindowStyle = GetWindowLong((HWND)GetHWND(), GWL_STYLE);
|
||||
|
||||
// save the old position, width & height, maximize state
|
||||
m_fsOldSize = GetRect();
|
||||
m_fsIsMaximized = IsMaximized();
|
||||
|
||||
// decide which window style flags to turn off
|
||||
LONG newStyle = m_fsOldWindowStyle;
|
||||
LONG offFlags = 0;
|
||||
|
||||
if (style & wxFULLSCREEN_NOBORDER)
|
||||
offFlags |= WS_BORDER;
|
||||
if (style & wxFULLSCREEN_NOCAPTION)
|
||||
offFlags |= (WS_CAPTION | WS_SYSMENU);
|
||||
|
||||
newStyle &= (~offFlags);
|
||||
|
||||
// change our window style to be compatible with full-screen mode
|
||||
SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle);
|
||||
|
||||
// resize to the size of the desktop
|
||||
int width, height;
|
||||
|
||||
RECT rect;
|
||||
::GetWindowRect(GetDesktopWindow(), &rect);
|
||||
width = rect.right - rect.left;
|
||||
height = rect.bottom - rect.top;
|
||||
|
||||
SetSize(width, height);
|
||||
|
||||
// now flush the window style cache and actually go full-screen
|
||||
SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
|
||||
|
||||
wxSizeEvent event(wxSize(width, height), GetId());
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsFullScreen())
|
||||
return FALSE;
|
||||
|
||||
m_fsIsShowing = FALSE;
|
||||
|
||||
wxToolBar *theToolBar = GetToolBar();
|
||||
|
||||
// restore the toolbar, menubar, and statusbar
|
||||
if (theToolBar && (m_fsStyle & wxFULLSCREEN_NOTOOLBAR))
|
||||
{
|
||||
theToolBar->SetSize(-1, m_fsToolBarHeight);
|
||||
theToolBar->Show(TRUE);
|
||||
}
|
||||
|
||||
if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && (m_fsStatusBarFields > 0))
|
||||
{
|
||||
CreateStatusBar(m_fsStatusBarFields);
|
||||
PositionStatusBar();
|
||||
}
|
||||
|
||||
if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
|
||||
SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
|
||||
|
||||
Maximize(m_fsIsMaximized);
|
||||
SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle);
|
||||
SetWindowPos((HWND)GetHWND(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y,
|
||||
m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Frame window
|
||||
*
|
||||
@@ -643,7 +770,7 @@ void wxFrame::PositionToolBar()
|
||||
}
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
if ( GetToolBar() )
|
||||
if ( GetToolBar() && GetToolBar()->IsShown() )
|
||||
{
|
||||
int tw, th;
|
||||
GetToolBar()->GetSize(&tw, &th);
|
||||
|
@@ -543,11 +543,11 @@ $(OBJECTS): $(WXINC)/wx/defs.h $(WXINC)/wx/object.h $(WXINC)/wx/setup.h
|
||||
$(COMMDIR)/y_tab.$(OBJSUFF): $(COMMDIR)/y_tab.c $(COMMDIR)/lex_yy.c
|
||||
$(CCLEX) -c $(CPPFLAGS) -DUSE_DEFINE -DYY_USE_PROTOS -o $@ $(COMMDIR)/y_tab.c
|
||||
|
||||
$(COMMDIR)/y_tab.c: $(COMMDIR)/dosyacc.c
|
||||
$(COPY) ..\common\dosyacc.c ..\common\y_tab.c
|
||||
$(COMMDIR)/y_tab.c: $(COMMDIR)/dosyacc.c
|
||||
$(COPY) ..$(COPYSEP)common$(COPYSEP)dosyacc.c ..$(COPYSEP)common$(COPYSEP)y_tab.c
|
||||
|
||||
$(COMMDIR)/lex_yy.c: $(COMMDIR)/doslex.c
|
||||
$(COPY) ..\common\doslex.c ..\common\lex_yy.c
|
||||
$(COPY) ..$(COPYSEP)common$(COPYSEP)doslex.c ..$(COPYSEP)common$(COPYSEP)lex_yy.c
|
||||
|
||||
# Replace lex with flex if you run into compilation
|
||||
# problems with lex_yy.c. See also note about LEX_SCANNER
|
||||
|
@@ -455,6 +455,64 @@ $D\dummydll.obj: dummydll.$(SRCSUFF) $(WXDIR)\include\wx\wx.h $(WXDIR)\include\w
|
||||
$(CPPFLAGS) $(MAKEPRECOMP) /Fo$D\dummydll.obj /c /Tp dummydll.cpp
|
||||
<<
|
||||
|
||||
# Compile certain files with no optimization (some files cause a
|
||||
# compiler crash for buggy versions of VC++, e.g. 4.0)
|
||||
noopt:
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(COMMDIR)\$D\datetime.obj /c /Tp $(COMMDIR)\datetime.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(COMMDIR)\$D\encconv.obj /c /Tp $(COMMDIR)\encconv.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(COMMDIR)\$D\fileconf.obj /c /Tp $(COMMDIR)\fileconf.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(COMMDIR)\$D\resource.obj /c /Tp $(COMMDIR)\resource.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(COMMDIR)\$D\textfile.obj /c /Tp $(COMMDIR)\textfile.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(GENDIR)\$D\choicdgg.obj /c /Tp $(GENDIR)\choicdgg.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(GENDIR)\$D\grid.obj /c /Tp $(GENDIR)\grid.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(GENDIR)\$D\logg.obj /c /Tp $(GENDIR)\logg.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(GENDIR)\$D\proplist.obj /c /Tp $(GENDIR)\proplist.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\clipbrd.obj /c /Tp $(MSWDIR)\clipbrd.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\control.obj /c /Tp $(MSWDIR)\control.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\listbox.obj /c /Tp $(MSWDIR)\listbox.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\mdi.obj /c /Tp $(MSWDIR)\mdi.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\menu.obj /c /Tp $(MSWDIR)\menu.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\notebook.obj /c /Tp $(MSWDIR)\notebook.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\tbar95.obj /c /Tp $(MSWDIR)\tbar95.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(MSWDIR)\$D\treectrl.obj /c /Tp $(MSWDIR)\treectrl.cpp
|
||||
<<
|
||||
cl @<<
|
||||
$(CPPFLAGS2) /Od /Fo$(HTMLDIR)\$D\helpfrm.obj /c /Tp $(HTMLDIR)\helpfrm.cpp
|
||||
<<
|
||||
|
||||
# If taking wxWindows from CVS, setup.h doesn't exist yet.
|
||||
# Actually the 'if not exist setup.h' test doesn't work
|
||||
# (copies the file anyway)
|
||||
|
@@ -724,7 +724,7 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height)
|
||||
int actual_width = rect2.right - rect2.left - rect.right + width;
|
||||
int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
|
||||
|
||||
if (GetStatusBar())
|
||||
if (GetStatusBar() && GetStatusBar()->IsShown())
|
||||
{
|
||||
int sx, sy;
|
||||
GetStatusBar()->GetSize(&sx, &sy);
|
||||
@@ -1033,7 +1033,7 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
|
||||
lpPos->cy = rectClient.bottom - rectClient.top;
|
||||
}
|
||||
wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
|
||||
if (pFrameWnd && pFrameWnd->GetToolBar())
|
||||
if (pFrameWnd && pFrameWnd->GetToolBar() && pFrameWnd->GetToolBar()->IsShown())
|
||||
{
|
||||
pFrameWnd->GetToolBar()->Refresh();
|
||||
}
|
||||
|
@@ -951,7 +951,7 @@ void wxMapBitmap(HBITMAP hBitmap, int width, int height)
|
||||
{BGR_BUTTONSHADOW, COLOR_BTNSHADOW}, // dark grey
|
||||
{BGR_BUTTONFACE, COLOR_BTNFACE}, // bright grey
|
||||
{BGR_BUTTONHILIGHT, COLOR_BTNHIGHLIGHT},// white
|
||||
{BGR_BACKGROUNDSEL, COLOR_HIGHLIGHT}, // blue
|
||||
/* {BGR_BACKGROUNDSEL, COLOR_HIGHLIGHT}, // blue */
|
||||
{BGR_BACKGROUND, COLOR_WINDOW} // magenta
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user