]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes for building wxMSW with --disbale-all-features
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 21 Jul 2007 02:05:03 +0000 (02:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 21 Jul 2007 02:05:03 +0000 (02:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

16 files changed:
include/wx/msw/private/timer.h
include/wx/msw/region.h
include/wx/sysopt.h
src/common/appcmn.cpp
src/common/containr.cpp
src/common/event.cpp
src/msw/app.cpp
src/msw/basemsw.cpp
src/msw/dc.cpp
src/msw/dib.cpp
src/msw/dir.cpp
src/msw/frame.cpp
src/msw/imaglist.cpp
src/msw/msgdlg.cpp
src/msw/toplevel.cpp
src/msw/utils.cpp

index 07139ee528af56cc937655479074fff21cf74075..f7044e07549f79008fbce5f7498788104fe5e2cd 100644 (file)
@@ -11,6 +11,8 @@
 #ifndef _WX_MSW_PRIVATE_TIMER_H_
 #define _WX_MSW_PRIVATE_TIMER_H_
 
+#if wxUSE_TIMER
+
 #include "wx/private/timer.h"
 
 class WXDLLIMPEXP_BASE wxMSWTimerImpl : public wxTimerImpl
@@ -27,4 +29,6 @@ protected:
     unsigned long m_id;
 };
 
+#endif // wxUSE_TIMER
+
 #endif // _WX_TIMERH_
index e9463fdd1389e51061a9570d42b2dbf66886e0ef..97203acb3f772625c8c7169533e1e98c723fb0ae 100644 (file)
@@ -21,6 +21,7 @@ public:
     wxRegion(const wxRect& rect);
     wxRegion(WXHRGN hRegion); // Hangs on to this region
     wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
+#if wxUSE_IMAGE
     wxRegion( const wxBitmap& bmp)
     {
         Union(bmp);
@@ -30,6 +31,7 @@ public:
     {
         Union(bmp, transColour, tolerance);
     }
+#endif // wxUSE_IMAGE
 
     virtual ~wxRegion();
 
index 0b8a7716661e32847c7a18607ee145c63de12daf..f0eee9422929b176e2fd6587c953d0b1faf1efbb 100644 (file)
 // Enables an application to influence the wxWidgets implementation
 // ----------------------------------------------------------------------------
 
-class WXDLLIMPEXP_BASE wxSystemOptions : public wxObject
+class
+#if wxUSE_SYSTEM_OPTIONS
+WXDLLIMPEXP_BASE
+#endif
+wxSystemOptions : public wxObject
 {
 public:
     wxSystemOptions() { }
index 8a33c3f31ffb4fec8ddebea7e090f5090b454aab..cf61da7e89cb76b92b0680ae325f65d19c507e1c 100644 (file)
@@ -456,8 +456,10 @@ wxMessageOutput *wxGUIAppTraitsBase::CreateMessageOutput()
     // wxMessageOutputMessageBox doesn't work under Motif
     #ifdef __WXMOTIF__
         return new wxMessageOutputLog;
-    #else
+    #elif wxUSE_MSGDLG
         return new wxMessageOutputMessageBox;
+    #else
+        return new wxMessageOutputStderr;
     #endif
 #endif // __UNIX__/!__UNIX__
 }
index f2d237a36d8f2766b9e9a965eda2876b4f0aba1b..c62e2ebd427c275967d3c9c3b006fb76d8e9017a 100644 (file)
@@ -149,7 +149,7 @@ void wxControlContainer::SetLastFocus(wxWindow *win)
 // within the same group. Used by wxSetFocusToChild on wxMSW
 // --------------------------------------------------------------------
 
-#ifdef __WXMSW__
+#if defined(__WXMSW__) && wxUSE_RADIOBTN
 
 wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn)
 {
@@ -372,12 +372,12 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
 
         if ( winFocus )
         {
-#ifdef __WXMSW__
+#if defined(__WXMSW__) && wxUSE_RADIOBTN
             // If we are in a radio button group, start from the first item in the
             // group
             if ( event.IsFromTab() && wxIsKindOf(winFocus, wxRadioButton ) )
                 winFocus = wxGetFirstButtonInGroup((wxRadioButton*)winFocus);
-#endif
+#endif // __WXMSW__
             // ok, we found the focus - now is it our child?
             start_node = children.Find( winFocus );
         }
@@ -451,7 +451,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
 
         wxWindow *child = node->GetData();
 
-#ifdef __WXMSW__
+#if defined(__WXMSW__) && wxUSE_RADIOBTN
         if ( event.IsFromTab() )
         {
             if ( wxIsKindOf(child, wxRadioButton) )
@@ -654,7 +654,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
 
         if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() )
         {
-#ifdef __WXMSW__
+#if defined(__WXMSW__) && wxUSE_RADIOBTN
             // If a radiobutton is the first focusable child, search for the
             // selected radiobutton in the same group
             wxRadioButton* btn = wxDynamicCast(child, wxRadioButton);
@@ -664,7 +664,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
                 if (selected)
                     child = selected;
             }
-#endif
+#endif // __WXMSW__
 
             wxLogTrace(TRACE_FOCUS,
                        _T("SetFocusToChild() => first child (0x%p)."),
index d0c22a72d1f226f6a5dc890a5bc0a4c574ea064e..3ac1284d863851f654528a90cdba568a65216912 100644 (file)
@@ -34,6 +34,7 @@
     #include "wx/module.h"
 
     #if wxUSE_GUI
+        #include "wx/window.h"
         #include "wx/control.h"
         #include "wx/dc.h"
         #include "wx/textctrl.h"
index 703871214cb0c5326c4c70afbba398a0566d89e2..682a3b3b298dd651a4ecd6c7d9b37eb9c43bbd6b 100644 (file)
@@ -266,11 +266,15 @@ wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
 #endif
 }
 
+#if wxUSE_TIMER
+
 wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
 {
     return new wxMSWTimerImpl(timer);
 }
 
+#endif // wxUSE_TIMER
+
 wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
 {
     return new wxEventLoop;
index 754dbc7ea35e9204fd9246db4d9b78b56be35406..5becc21693777f53813d933f6b9f9bf9968c3470 100644 (file)
@@ -82,16 +82,24 @@ bool wxConsoleAppTraits::DoMessageFromThreadWait()
     return true;
 }
 
+#if wxUSE_TIMER
+
 wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
 {
     return new wxMSWTimerImpl(timer);
 }
 
+#endif // wxUSE_TIMER
+
+#if wxUSE_CONSOLE_EVENTLOOP
+
 wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
 {
     return new wxEventLoop();
 }
 
+#endif // wxUSE_CONSOLE_EVENTLOOP
+
 WXDWORD wxConsoleAppTraits::WaitForThread(WXHANDLE hThread)
 {
     return DoSimpleWaitForThread(hThread);
index 6e0ea3100b992fc5b1eacd4ba1827a86dd5516ed..d1ef3afda27e39003400ca520954010e31a4420e 100644 (file)
@@ -205,6 +205,8 @@ private:
     DECLARE_NO_COPY_CLASS(StretchBltModeChanger)
 };
 
+#if wxUSE_DYNLIB_CLASS
+
 // helper class to cache dynamically loaded libraries and not attempt reloading
 // them if it fails
 class wxOnceOnlyDLLLoader
@@ -244,6 +246,8 @@ private:
 static wxOnceOnlyDLLLoader wxGDI32DLL(_T("gdi32"));
 static wxOnceOnlyDLLLoader wxMSIMG32DLL(_T("msimg32"));
 
+#endif // wxUSE_DYNLIB_CLASS
+
 // ===========================================================================
 // implementation
 // ===========================================================================
@@ -2673,6 +2677,8 @@ void wxDC::DoGradientFillLinear (const wxRect& rect,
     wxDCBase::DoGradientFillLinear(rect, initialColour, destColour, nDirection);
 }
 
+#if wxUSE_DYNLIB_CLASS
+
 static DWORD wxGetDCLayout(HDC hdc)
 {
     typedef DWORD (WINAPI *GetLayout_t)(HDC);
@@ -2715,3 +2721,17 @@ void wxDC::SetLayoutDirection(wxLayoutDirection dir)
 
     pfnSetLayout(GetHdc(), layout);
 }
+
+#else // !wxUSE_DYNLIB_CLASS
+
+// we can't provide RTL support without dynamic loading, so stub it out
+wxLayoutDirection wxDC::GetLayoutDirection() const
+{
+    return wxLayout_Default;
+}
+
+void wxDC::SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
+{
+}
+
+#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
index 2abcde95b7fddca404af6d7f4ba47abd1968c828..f79d16a1132704059b1f87ab9a8926b5288931f4 100644 (file)
@@ -307,6 +307,7 @@ bool wxDIB::Save(const wxString& filename)
 {
     wxCHECK_MSG( m_handle, false, _T("wxDIB::Save(): invalid object") );
 
+#if wxUSE_FILE
     wxFile file(filename, wxFile::write);
     bool ok = file.IsOpened();
     if ( ok )
@@ -335,6 +336,9 @@ bool wxDIB::Save(const wxString& filename)
                         file.Write(ds.dsBm.bmBits, sizeImage) == sizeImage;
         }
     }
+#else // !wxUSE_FILE
+    bool ok = false;
+#endif // wxUSE_FILE/!wxUSE_FILE
 
     if ( !ok )
     {
index 5525d72a611517124ccef1474efe02717e140c28..ae9d7ddb9b573b2fc7989c9ec16b6b02c343da0c 100644 (file)
@@ -201,7 +201,7 @@ bool wxDirData::Read(wxString *filename)
 
         if ( err != ERROR_FILE_NOT_FOUND && err != ERROR_NO_MORE_FILES )
         {
-            wxLogSysError(err, _("Can not enumerate files in directory '%s'"),
+            wxLogSysError(err, wxString(_("Can not enumerate files in directory '%s'")),
                           m_dirname.c_str());
         }
 #endif // __WIN32__
index 8f0ce449bc11cf5673bfe68be29604f70255e0cf..2701eb8ad2c406af685f66c4b6ce854f000c5d8e 100644 (file)
@@ -563,6 +563,7 @@ bool wxFrame::ShowFullScreen(bool show, long style)
         }
 #endif // wxUSE_TOOLBAR
 
+#if wxUSE_MENUS
         if (m_fsStyle & wxFULLSCREEN_NOMENUBAR)
         {
             WXHMENU menu = m_hMenu;
@@ -584,6 +585,7 @@ bool wxFrame::ShowFullScreen(bool show, long style)
                 ::SetMenu(GetHwnd(), (HMENU)menu);
             }
         }
+#endif // wxUSE_MENUS
 
 #if wxUSE_STATUSBAR
         wxStatusBar *theStatusBar = GetStatusBar();
@@ -984,6 +986,8 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
     return false;
 }
 
+#if wxUSE_MENUS
+
 bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
 {
     int item;
@@ -1025,6 +1029,30 @@ bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup)
     return GetEventHandler()->ProcessEvent(event);
 }
 
+bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu)
+{
+    wxMenu* menu = NULL;
+    if (GetMenuBar())
+    {
+        int nCount = GetMenuBar()->GetMenuCount();
+        for (int n = 0; n < nCount; n++)
+        {
+            if (GetMenuBar()->GetMenu(n)->GetHMenu() == hMenu)
+            {
+                menu = GetMenuBar()->GetMenu(n);
+                break;
+            }
+        }
+    }
+
+    wxMenuEvent event(wxEVT_MENU_OPEN, 0, menu);
+    event.SetEventObject(this);
+
+    return GetEventHandler()->ProcessEvent(event);
+}
+
+#endif // wxUSE_MENUS
+
 // ---------------------------------------------------------------------------
 // the window proc for wxFrame
 // ---------------------------------------------------------------------------
@@ -1061,11 +1089,12 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
             processed = HandlePaint();
             break;
 
+#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
+#if wxUSE_MENUS
         case WM_INITMENUPOPUP:
             processed = HandleInitMenuPopup((WXHMENU) wParam);
             break;
 
-#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
         case WM_MENUSELECT:
             {
                 WXWORD item, flags;
@@ -1079,6 +1108,7 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
         case WM_EXITMENULOOP:
             processed = HandleMenuLoop(wxEVT_MENU_CLOSE, (WXWORD)wParam);
             break;
+#endif // wxUSE_MENUS
 
         case WM_QUERYDRAGICON:
             {
@@ -1098,29 +1128,6 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
     return rc;
 }
 
-// handle WM_INITMENUPOPUP message
-bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu)
-{
-    wxMenu* menu = NULL;
-    if (GetMenuBar())
-    {
-        int nCount = GetMenuBar()->GetMenuCount();
-        for (int n = 0; n < nCount; n++)
-        {
-            if (GetMenuBar()->GetMenu(n)->GetHMenu() == hMenu)
-            {
-                menu = GetMenuBar()->GetMenu(n);
-                break;
-            }
-        }
-    }
-
-    wxMenuEvent event(wxEVT_MENU_OPEN, 0, menu);
-    event.SetEventObject(this);
-
-    return GetEventHandler()->ProcessEvent(event);
-}
-
 // ----------------------------------------------------------------------------
 // wxFrame size management: we exclude the areas taken by menu/status/toolbars
 // from the client area, so the client area is what's really available for the
index 317bc0f788f390e55bc011c613c668511d0ee9b8..7548695b8c45884ebbf9feb7c7bdfb3d7a16c3cf 100644 (file)
@@ -278,7 +278,7 @@ bool wxImageList::Draw(int index,
 // Get the bitmap
 wxBitmap wxImageList::GetBitmap(int index) const
 {
-#if wxUSE_WXDIB
+#if wxUSE_WXDIB && wxUSE_IMAGE
     int bmp_width = 0, bmp_height = 0;
     GetSize(index, bmp_width, bmp_height);
 
index 76eda81fc92f0981b514a5053f382857ae0f16ed..061b9211a2850441e9282fa599e6e98f71eac77d 100644 (file)
@@ -16,6 +16,8 @@
     #pragma hdrstop
 #endif
 
+#if wxUSE_MSGDLG
+
 #include "wx/msgdlg.h"
 
 #ifndef WX_PRECOMP
@@ -132,3 +134,5 @@ int wxMessageDialog::ShowModal()
     }
     return ans;
 }
+
+#endif // wxUSE_MSGDLG
index 272d3c15bf5c656e8b50d508862bdc7c71276e32..359c874cb8942ee0ea0080e69a64953a952750f9 100644 (file)
@@ -1087,7 +1087,7 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags)
     // provide FlashWindowEx() declaration, so try to detect whether we have
     // real headers for WINVER 0x0500 by checking for existence of a symbol not
     // declated in MSVC6 header
-#if defined(FLASHW_STOP) && defined(VK_XBUTTON1)
+#if defined(FLASHW_STOP) && defined(VK_XBUTTON1) && wxUSE_DYNLIB_CLASS
     // available in the headers, check if it is supported by the system
     typedef BOOL (WINAPI *FlashWindowEx_t)(FLASHWINFO *pfwi);
     FlashWindowEx_t s_pfnFlashWindowEx = NULL;
@@ -1133,6 +1133,7 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags)
 
 bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
 {
+#if wxUSE_DYNLIB_CLASS
     typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD);
     static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL;
 
@@ -1144,6 +1145,7 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
     }
     if ( pSetLayeredWindowAttributes == NULL )
         return false;
+#endif // wxUSE_DYNLIB_CLASS
 
     LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE);
 
@@ -1155,11 +1157,16 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
         return true;
     }
 
+#if wxUSE_DYNLIB_CLASS
     // Otherwise, set the layered style if needed and set the alpha value
     if ((exstyle & WS_EX_LAYERED) == 0 )
         SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED);
 
-    return pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) != 0;
+    if ( pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) )
+        return true;
+#endif // wxUSE_DYNLIB_CLASS
+
+    return false;
 }
 
 bool wxTopLevelWindowMSW::CanSetTransparent()
index c0efa166b7e964f6134be6bf0dade8abfa83db23..243c3320f5609062d39522b8bfc938a429c3a789 100644 (file)
@@ -158,7 +158,7 @@ bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
 // get full hostname (with domain name if possible)
 bool wxGetFullHostName(wxChar *buf, int maxSize)
 {
-#if !defined( __WXMICROWIN__) && wxUSE_DYNAMIC_LOADER && wxUSE_SOCKETS
+#if !defined( __WXMICROWIN__) && wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS
     // TODO should use GetComputerNameEx() when available
 
     // we don't want to always link with Winsock DLL as we might not use it at
@@ -1176,7 +1176,7 @@ bool wxIsPlatform64Bit()
 {
 #if defined(_WIN64)
     return true;  // 64-bit programs run only on Win64
-#else // Win32
+#elif wxUSE_DYNLIB_CLASS // Win32
     // 32-bit programs run on both 32-bit and 64-bit Windows so check
     typedef BOOL (WINAPI *IsWow64Process_t)(HANDLE, BOOL *);
 
@@ -1192,6 +1192,8 @@ bool wxIsPlatform64Bit()
     //else: running under a system without Win64 support
 
     return wow64 != FALSE;
+#else
+    return false;
 #endif // Win64/Win32
 }