From 0b4f47a319cfaa434e00025aa779e407fbacee23 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Sun, 30 May 2004 15:14:41 +0000 Subject: [PATCH] partially applied patch #895170: "Building with minimal setup.h - continuation" git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27513 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/button.h | 20 ++++++++++++----- include/wx/chkconf.h | 47 +++++++++++++++++++++++++++++++++++++-- include/wx/choicdlg.h | 4 ++++ include/wx/log.h | 41 +++++++++++++++++++--------------- src/common/wincmn.cpp | 2 ++ src/html/helpdata.cpp | 6 +++++ src/msw/clipbrd.cpp | 2 +- src/msw/display.cpp | 6 ++++- src/msw/tglbtn.cpp | 4 ++++ src/msw/window.cpp | 8 ++++++- src/univ/themes/win32.cpp | 12 ++++++++++ 11 files changed, 123 insertions(+), 29 deletions(-) diff --git a/include/wx/button.h b/include/wx/button.h index 1e7f14a0f7..428e6e0611 100644 --- a/include/wx/button.h +++ b/include/wx/button.h @@ -14,15 +14,11 @@ #include "wx/defs.h" -#if wxUSE_BUTTON - // ---------------------------------------------------------------------------- -// wxButton flags +// wxButton flags shared with other classes // ---------------------------------------------------------------------------- -// These two flags are obsolete -#define wxBU_NOAUTODRAW 0x0000 -#define wxBU_AUTODRAW 0x0004 +#if wxUSE_TOGGLEBTN || wxUSE_BUTTON // These flags affect label alignment #define wxBU_LEFT 0x0040 @@ -30,6 +26,18 @@ #define wxBU_RIGHT 0x0100 #define wxBU_BOTTOM 0x0200 +#endif + +#if wxUSE_BUTTON + +// ---------------------------------------------------------------------------- +// wxButton specific flags +// ---------------------------------------------------------------------------- + +// These two flags are obsolete +#define wxBU_NOAUTODRAW 0x0000 +#define wxBU_AUTODRAW 0x0004 + // by default, the buttons will be created with some (system dependent) // minimal size to make them look nicer, giving this style will make them as // small as possible diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 98e5bca5e3..ddcf097547 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -946,6 +946,17 @@ # endif #endif /* controls */ +#if wxUSE_BMPBUTTON +# if !wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BMPBUTTON requires wxUSE_BUTTON" +# else +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* wxUSE_BMPBUTTON */ + #if wxUSE_NOTEBOOK || wxUSE_LISTBOOK # if defined(wxUSE_BOOKCTRL) && !wxUSE_BOOKCTRL # ifdef wxABORT_ON_CONFIG_ERROR @@ -1201,6 +1212,17 @@ # endif #endif /* wxUSE_RADIOBTN */ +#if wxUSE_HELP +# if !wxUSE_BMPBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HELP requires wxUSE_BMPBUTTON" +# else +# undef wxUSE_BMPBUTTON +# define wxUSE_BMPBUTTON 1 +# endif +# endif +#endif /* wxUSE_HELP */ + #if wxUSE_WXHTML_HELP # if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK # ifdef wxABORT_ON_CONFIG_ERROR @@ -1378,6 +1400,25 @@ # endif #endif /* wxUSE_FILEDLG */ +#if !wxUSE_BUTTON +# if wxUSE_PROGRESSDLG || \ + wxUSE_FONTDLG || \ + wxUSE_FILEDLG || \ + wxUSE_CHOICEDLG || \ + wxUSE_NUMBERDLG || \ + wxUSE_TEXTDLG || \ + wxUSE_DIRDLG || \ + wxUSE_STARTUP_TIPS || \ + wxUSE_WIZARDDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Common and generic dialogs require wxUSE_BUTTON" +# else +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* wxUSE_PROGRESSDLG */ + #if !wxUSE_TOOLBAR # if wxUSE_TOOLBAR_NATIVE # ifdef wxABORT_ON_CONFIG_ERROR @@ -1444,12 +1485,14 @@ #endif /* wxUSE_LOGWINDOW */ #if wxUSE_LOG_DIALOG -# if !wxUSE_LISTCTRL +# if !wxUSE_LISTCTRL || !wxUSE_BUTTON # ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL" +# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL and wxUSE_BUTTON" # else # undef wxUSE_LISTCTRL # define wxUSE_LISTCTRL 1 +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 # endif # endif #endif /* wxUSE_LOG_DIALOG */ diff --git a/include/wx/choicdlg.h b/include/wx/choicdlg.h index 52439ffd71..daa7b77880 100644 --- a/include/wx/choicdlg.h +++ b/include/wx/choicdlg.h @@ -1,7 +1,11 @@ #ifndef _WX_CHOICDLG_H_BASE_ #define _WX_CHOICDLG_H_BASE_ +#if wxUSE_CHOICEDLG + #include "wx/generic/choicdgg.h" +#endif + #endif // _WX_CHOICDLG_H_BASE_ diff --git a/include/wx/log.h b/include/wx/log.h index eb7a58c98a..6de7068a44 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -18,6 +18,24 @@ #include "wx/defs.h" +// ---------------------------------------------------------------------------- +// common constants for use in wxUSE_LOG/!wxUSE_LOG +// ---------------------------------------------------------------------------- + +// the trace masks have been superceded by symbolic trace constants, they're +// for compatibility only andwill be removed soon - do NOT use them + +// meaning of different bits of the trace mask (which allows selectively +// enable/disable some trace messages) +#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) +#define wxTraceMessages 0x0002 // trace window messages/X callbacks +#define wxTraceResAlloc 0x0004 // trace GDI resource allocation +#define wxTraceRefCount 0x0008 // trace various ref counting operations + +#ifdef __WXMSW__ + #define wxTraceOleCalls 0x0100 // OLE interface calls +#endif + // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- @@ -93,20 +111,6 @@ enum #define wxTRACE_OleCalls wxT("ole") // OLE interface calls #endif -// the trace masks have been superceded by symbolic trace constants, they're -// for compatibility only andwill be removed soon - do NOT use them - -// meaning of different bits of the trace mask (which allows selectively -// enable/disable some trace messages) -#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) -#define wxTraceMessages 0x0002 // trace window messages/X callbacks -#define wxTraceResAlloc 0x0004 // trace GDI resource allocation -#define wxTraceRefCount 0x0008 // trace various ref counting operations - -#ifdef __WXMSW__ - #define wxTraceOleCalls 0x0100 // OLE interface calls -#endif - #include "wx/iosfwrap.h" // ---------------------------------------------------------------------------- @@ -444,9 +448,6 @@ extern void expdecl wxVLog##level(arg, const wxChar *szFormat, \ va_list argptr); \ extern void expdecl wxLog##level(arg, const wxChar *szFormat, \ ...) ATTRIBUTE_PRINTF_2 -#define DECLARE_LOG_FUNCTION2(level, arg) \ - DECLARE_LOG_FUNCTION2_EXP(level, arg, WXDLLIMPEXP_BASE) - #else // !wxUSE_LOG // log functions do nothing at all @@ -454,7 +455,7 @@ extern void expdecl wxLog##level(arg, const wxChar *szFormat, \ inline void wxVLog##level(const wxChar *szFormat, \ va_list argptr) { } \ inline void wxLog##level(const wxChar *szFormat, ...) { } -#define DECLARE_LOG_FUNCTION2(level, arg) \ +#define DECLARE_LOG_FUNCTION2_EXP(level, arg, expdecl) \ inline void wxVLog##level(arg, const wxChar *szFormat, \ va_list argptr) {} \ inline void wxLog##level(arg, const wxChar *szFormat, ...) { } @@ -474,6 +475,9 @@ public: #define wxTRACE_OleCalls wxEmptyString // OLE interface calls #endif // wxUSE_LOG/!wxUSE_LOG +#define DECLARE_LOG_FUNCTION2(level, arg) \ + DECLARE_LOG_FUNCTION2_EXP(level, arg, WXDLLIMPEXP_BASE) + // a generic function for all levels (level is passes as parameter) DECLARE_LOG_FUNCTION2(Generic, wxLogLevel level); @@ -492,6 +496,7 @@ DECLARE_LOG_FUNCTION(Status); #if wxUSE_GUI // this one is the same as previous except that it allows to explicitly + class wxFrame; // specify the frame to which the output should go DECLARE_LOG_FUNCTION2_EXP(Status, wxFrame *pFrame, WXDLLIMPEXP_CORE); #endif // wxUSE_GUI diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 0cb93c3665..d39583bbb8 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -2570,9 +2570,11 @@ wxAccStatus wxWindowAccessible::GetName(int childId, wxString* name) // This will eventually be replaced by specialised // accessible classes, one for each kind of wxWidgets // control or window. +#if wxUSE_BUTTON if (GetWindow()->IsKindOf(CLASSINFO(wxButton))) title = ((wxButton*) GetWindow())->GetLabel(); else +#endif title = GetWindow()->GetName(); if (!title.IsEmpty()) diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index c0418b8d39..88cad1d2a8 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -543,6 +543,7 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, // Now store the contents range bookr->SetContentsRange(cont_start, m_ContentsCnt); +#if wxUSE_FONTMAP // Convert encoding, if neccessary: if (encoding != wxFONTENCODING_SYSTEM) { @@ -559,6 +560,11 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, conv.Convert(m_Contents[i].m_Name); } } +#else + wxUnusedVar(IndexOld); + wxUnusedVar(ContentsOld); + wxASSERT_MSG(encoding == wxFONTENCODING_SYSTEM, wxT("Encoding can't be converted")); +#endif m_BookRecords.Add(bookr); if (m_IndexCnt > 0) diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 49cc833ca9..c3ed1b194b 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -665,7 +665,7 @@ bool wxClipboard::AddData( wxDataObject *data ) { #if 1 // TODO - wxLogError("Not implemented because wxMetafileDataObject does not contain width and height values."); + wxLogError(wxT("Not implemented because wxMetafileDataObject does not contain width and height values.")); return FALSE; #else wxMetafileDataObject* metaFileDataObject = diff --git a/src/msw/display.cpp b/src/msw/display.cpp index 04ee1a7edf..86f353b6d8 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -242,12 +242,16 @@ HRESULT WINAPI wxDDEnumModesCallback(LPDDSURFACEDESC lpDDSurfaceDesc, // initialize gs_displays using DirectX functions static bool DoInitDirectX() { +#if wxUSE_LOG // suppress the errors if ddraw.dll is not found wxLog::EnableLogging(false); +#endif wxDynamicLibrary dllDX(_T("ddraw.dll")); - wxLog::EnableLogging(true); +#if wxUSE_LOG + wxLog::EnableLogging(); +#endif if ( !dllDX.IsLoaded() ) return false; diff --git a/src/msw/tglbtn.cpp b/src/msw/tglbtn.cpp index 072604992c..9b6d07128d 100644 --- a/src/msw/tglbtn.cpp +++ b/src/msw/tglbtn.cpp @@ -130,11 +130,15 @@ wxSize wxToggleButton::DoGetBestSize() const // the button height is proportional to the height of the font used int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar); +#if wxUSE_BUTTON wxSize sz = wxButton::GetDefaultSize(); if (wBtn > sz.x) sz.x = wBtn; if (hBtn > sz.y) sz.y = hBtn; +#else + wxSize sz(wBtn, hBtn); +#endif return sz; } diff --git a/src/msw/window.cpp b/src/msw/window.cpp index ccb40f124c..6a4ffb7334 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1905,8 +1905,8 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) return true; } else // no default button - { #endif // wxUSE_BUTTON + { // this is a quick and dirty test for a text // control if ( !(lDlgCode & DLGC_HASSETSEL) ) @@ -2346,9 +2346,11 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l #ifndef __WXWINCE__ case WM_PRINT: { +#if wxUSE_LISTCTRL // Don't call the wx handlers in this case if ( wxIsKindOf(this, wxListCtrl) ) break; +#endif if ( lParam & PRF_ERASEBKGND ) HandleEraseBkgnd((WXHDC)(HDC)wParam); @@ -5794,6 +5796,8 @@ bool wxWindowMSW::UnregisterHotKey(int hotkeyId) return true; } +#if wxUSE_ACCEL + bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam) { int hotkeyId = wParam; @@ -5810,6 +5814,8 @@ bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam) return GetEventHandler()->ProcessEvent(event); } +#endif // wxUSE_ACCEL + #endif // wxUSE_HOTKEY // Not tested under WinCE diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 426420ec26..cb69172cc5 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -4543,7 +4543,9 @@ private: wxWin32FrameInputHandler *m_inputHnd; wxTopLevelWindow *m_wnd; +#if wxUSE_ACCEL wxAcceleratorTable m_oldAccelTable; +#endif }; wxWin32SystemMenuEvtHandler::wxWin32SystemMenuEvtHandler( @@ -4560,6 +4562,7 @@ void wxWin32SystemMenuEvtHandler::Attach(wxInputConsumer *consumer) m_wnd = wxStaticCast(consumer->GetInputWindow(), wxTopLevelWindow); m_wnd->PushEventHandler(this); +#if wxUSE_ACCEL // VS: This code relies on using generic implementation of // wxAcceleratorTable in wxUniv! wxAcceleratorTable table = *m_wnd->GetAcceleratorTable(); @@ -4567,13 +4570,16 @@ void wxWin32SystemMenuEvtHandler::Attach(wxInputConsumer *consumer) table.Add(wxAcceleratorEntry(wxACCEL_ALT, WXK_SPACE, wxID_SYSTEM_MENU)); table.Add(wxAcceleratorEntry(wxACCEL_ALT, WXK_F4, wxID_CLOSE_FRAME)); m_wnd->SetAcceleratorTable(table); +#endif } void wxWin32SystemMenuEvtHandler::Detach() { if ( m_wnd ) { +#if wxUSE_ACCEL m_wnd->SetAcceleratorTable(m_oldAccelTable); +#endif m_wnd->RemoveEventHandler(this); m_wnd = NULL; } @@ -4595,10 +4601,16 @@ void wxWin32SystemMenuEvtHandler::OnSystemMenu(wxCommandEvent &WXUNUSED(event)) pt.x = -pt.x + border; pt.y = -pt.y + border + FRAME_TITLEBAR_HEIGHT; +#if wxUSE_ACCEL wxAcceleratorTable table = *m_wnd->GetAcceleratorTable(); m_wnd->SetAcceleratorTable(wxNullAcceleratorTable); +#endif + m_inputHnd->PopupSystemMenu(m_wnd, pt); + +#if wxUSE_ACCEL m_wnd->SetAcceleratorTable(table); +#endif } void wxWin32SystemMenuEvtHandler::OnCloseFrame(wxCommandEvent &WXUNUSED(event))