]> git.saurik.com Git - wxWidgets.git/commitdiff
Added ShowFullScreen
authorJulian Smart <julian@anthemion.co.uk>
Tue, 8 Feb 2000 19:14:50 +0000 (19:14 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 8 Feb 2000 19:14:50 +0000 (19:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/frame.h
include/wx/metafile.h
include/wx/msw/frame.h
src/msw/dialup.cpp
src/msw/enhmeta.cpp
src/msw/frame.cpp
src/msw/makefile.g95
src/msw/makefile.vc
src/msw/mdi.cpp
src/msw/tbar95.cpp

index b8308307e4affb370a96d6ca4e3f666069272988..d21024cfb23f5070390973b75ae99619cc924a75 100644 (file)
@@ -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
 //
index 48cd91d5977a3a40a0dc2eff37979a6190dbe881..db81c1f55580f61f285005b33cce98a5f342ff59 100644 (file)
@@ -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
index 4294359921a0830927d1f9efe2fab6b429bdefb6..f17f7e57dfbfe722952eb74ed3c05c68b81add57 100644 (file)
@@ -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;
index face5501d171214e7db5fb24ad84cbbd389fbf35..b812904744dbfb449b8f0492187f3bdcb535df9c 100644 (file)
 
 #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
 // ----------------------------------------------------------------------------
index 6602ce9a2471df2f6603e5b7075bc91dc4598aa8..189d2980b83e842988ce71ec4f3151359baed866 100644 (file)
@@ -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
index a213f318a35614c981c48e76259572e15b3ae729..d698638b4f485072ab55e3e651769322e950a2b0 100644 (file)
@@ -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);
index c67555500ba931f60db09aac121ade00e4116e93..bcf223fb664509f1c4df666e2e6911e78d3f5a30 100644 (file)
@@ -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
index 58344b50a96b798322b175a2b15d1b26930c0128..b5da3c6b18ad7c7e3dcbfe446ca264e8d980c443 100644 (file)
@@ -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)
index 19d9e410cf5dc537485ea7a182600bd1e7117923..8e213d82129e1bce3be7df131b6a89f9eb2ee02d 100644 (file)
@@ -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();
         }
index daa5ab310040f713d51e9496c93a09d87fc93a8d..e101ced821957b67ec9cee21c60a357ea985c16e 100644 (file)
@@ -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
   };