From 9a6384ca1e6e9a84f755dbca28875a5e89267766 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 8 Jun 2006 11:25:30 +0000 Subject: [PATCH] Improvements for building minimal builds and new ports: wxUSE_* usage and minor cleaning. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 7 +++ include/wx/generic/region.h | 13 +++++ include/wx/univ/renderer.h | 74 ++++++++++++++++++++++--- include/wx/univ/scrtimer.h | 6 +++ include/wx/univ/window.h | 18 +++++-- src/common/image.cpp | 31 ++++++----- src/common/init.cpp | 4 +- src/common/pickerbase.cpp | 7 +++ src/common/popupcmn.cpp | 12 ++--- src/common/utilscmn.cpp | 17 +++--- src/generic/mdig.cpp | 6 ++- src/generic/msgdlgg.cpp | 4 ++ src/generic/regiong.cpp | 71 ++++++++++++------------ src/univ/ctrlrend.cpp | 10 ++++ src/univ/framuniv.cpp | 12 ++--- src/univ/scrarrow.cpp | 24 +++++++-- src/univ/scrolbar.cpp | 4 ++ src/univ/scrthumb.cpp | 12 ++++- src/univ/themes/gtk.cpp | 100 ++++++++++++++++++++++++++++++++-- src/univ/themes/win32.cpp | 104 ++++++++++++++++++++++++++++++++++-- src/univ/topluniv.cpp | 9 ++-- src/univ/winuniv.cpp | 90 +++++++++++++++++++++++++++---- 22 files changed, 523 insertions(+), 112 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 9739fbf260..f8cda81a80 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -597,6 +597,13 @@ typedef int wxWindowID; #define WXUNUSED_IN_WINCE(param) param #endif +/* unused parameters in non stream builds */ +#if wxUSE_STREAMS + #define WXUNUSED_UNLESS_STREAMS(param) param +#else + #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param) +#endif + /* some compilers give warning about a possibly unused variable if it is */ /* initialized in both branches of if/else and shut up if it is initialized */ /* when declared, but other compilers then give warnings about unused variable */ diff --git a/include/wx/generic/region.h b/include/wx/generic/region.h index a4fc63a5bd..3498ffec64 100644 --- a/include/wx/generic/region.h +++ b/include/wx/generic/region.h @@ -90,6 +90,19 @@ public: // Does the region contain the rectangle rect? wxRegionContain Contains(const wxRect& rect) const; + // Use the non-transparent pixels of a wxBitmap for the region to combine + // with this region. First version takes transparency from bitmap's mask, + // second lets the user specify the colour to be treated as transparent + // along with an optional tolerance value. + // NOTE: implemented in common/rgncmn.cpp + bool Union(const wxBitmap& bmp); + bool Union(const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0); + + // Convert the region to a B&W bitmap with the white pixels being inside + // the region. + wxBitmap ConvertToBitmap() const; + protected: virtual wxObjectRefData *CreateRefData() const; virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; diff --git a/include/wx/univ/renderer.h b/include/wx/univ/renderer.h index 3ca35e91ef..1db8d9e190 100644 --- a/include/wx/univ/renderer.h +++ b/include/wx/univ/renderer.h @@ -30,16 +30,27 @@ #include "wx/renderer.h" +class WXDLLEXPORT wxWindow; class WXDLLEXPORT wxDC; class WXDLLEXPORT wxCheckListBox; -class WXDLLEXPORT wxListBox; -class WXDLLEXPORT wxMenu; -class WXDLLEXPORT wxMenuGeometryInfo; + +#if wxUSE_LISTBOX + class WXDLLEXPORT wxListBox; +#endif // wxUSE_LISTBOX + +#if wxUSE_MENUS + class WXDLLEXPORT wxMenu; + class WXDLLEXPORT wxMenuGeometryInfo; +#endif // wxUSE_MENUS + class WXDLLEXPORT wxScrollBar; -class WXDLLEXPORT wxTextCtrl; -class WXDLLEXPORT wxWindow; + +#if wxUSE_TEXTCTRL + class WXDLLEXPORT wxTextCtrl; +#endif + #if wxUSE_GAUGE -class WXDLLEXPORT wxGauge; + class WXDLLEXPORT wxGauge; #endif // wxUSE_GAUGE #include "wx/string.h" @@ -199,6 +210,7 @@ public: wxAlignment align = wxALIGN_LEFT, int indexAccel = -1) = 0; +#if wxUSE_TOOLBAR // draw a toolbar button (label may be empty, bitmap may be invalid, if // both conditions are true this function draws a separator) virtual void DrawToolBarButton(wxDC& dc, @@ -208,6 +220,7 @@ public: int flags = 0, long style = 0, int tbarStyle = 0) = 0; +#endif // wxUSE_TOOLBAR // draw a (part of) line in the text control virtual void DrawTextLine(wxDC& dc, @@ -229,6 +242,8 @@ public: int flags = 0, int indexAccel = -1) = 0; +#if wxUSE_SLIDER + // draw the slider shaft virtual void DrawSliderShaft(wxDC& dc, const wxRect& rect, @@ -255,7 +270,9 @@ public: int step = 1, int flags = 0, long style = 0) = 0; +#endif // wxUSE_SLIDER +#if wxUSE_MENUS // draw a menu bar item virtual void DrawMenuBarItem(wxDC& dc, const wxRect& rect, @@ -279,13 +296,16 @@ public: virtual void DrawMenuSeparator(wxDC& dc, wxCoord y, const wxMenuGeometryInfo& geomInfo) = 0; +#endif // wxUSE_MENUS +#if wxUSE_STATUSBAR // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is // interpreted specially and means "draw the status bar grip" here virtual void DrawStatusField(wxDC& dc, const wxRect& rect, const wxString& label, int flags = 0, int style = 0) = 0; +#endif // wxUSE_STATUSBAR // draw complete frame/dialog titlebar virtual void DrawFrameTitleBar(wxDC& dc, @@ -350,6 +370,8 @@ public: // the control looks "nice" if it uses the adjusted rectangle virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0; +#if wxUSE_SCROLLBAR + // get the size of a scrollbar arrow virtual wxSize GetScrollbarArrowSize() const = 0; @@ -373,6 +395,8 @@ public: virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord) = 0; +#endif // wxUSE_SCROLLBAR + // get the height of a listbox item from the base font height virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0; @@ -388,6 +412,7 @@ public: // get the margins between/around the toolbar buttons virtual wxSize GetToolBarMargin() const = 0; +#if wxUSE_TEXTCTRL // convert between text rectangle and client rectangle for text controls: // the former is typicall smaller to leave margins around text virtual wxRect GetTextTotalArea(const wxTextCtrl *text, @@ -397,6 +422,7 @@ public: virtual wxRect GetTextClientArea(const wxTextCtrl *text, const wxRect& rectTotal, wxCoord *extraSpaceBeyond) const = 0; +#endif // wxUSE_TEXTCTRL // get the overhang of a selected tab virtual wxSize GetTabIndent() const = 0; @@ -404,6 +430,7 @@ public: // get the padding around the text in a tab virtual wxSize GetTabPadding() const = 0; +#if wxUSE_SLIDER // get the default size of the slider in lesser dimension (i.e. height of a // horizontal slider or width of a vertical one) virtual wxCoord GetSliderDim() const = 0; @@ -421,10 +448,12 @@ public: virtual wxSize GetSliderThumbSize(const wxRect& rect, int lenThumb, wxOrientation orient) const = 0; +#endif // wxUSE_SLIDER // get the size of one progress bar step (in horz and vertical directions) virtual wxSize GetProgressBarStep() const = 0; +#if wxUSE_MENUS // get the size of rectangle to use in the menubar for the given text rect virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0; @@ -435,10 +464,13 @@ public: // the returned pointer must be deleted by the caller virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, const wxMenu& menu) const = 0; +#endif // wxUSE_MENUS +#if wxUSE_STATUSBAR // get the borders around the status bar fields (x and y fields of the // return value) and also, optionally, the border between the fields virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const = 0; +#endif // wxUSE_STATUSBAR // get client area rectangle of top level window (i.e. subtract // decorations from given rectangle) @@ -477,6 +509,7 @@ protected: int selStart, int selEnd, int flags); +#if wxUSE_SCROLLBAR // standard scrollbar hit testing: this assumes that it only has 2 arrows // and a thumb, so the themes which have more complicated scrollbars (e.g. // BeOS) can't use this method @@ -501,6 +534,8 @@ protected: int range, wxCoord *thumbStart, wxCoord *thumbEnd); +#endif // wxUSE_SCROLLBAR + }; // ---------------------------------------------------------------------------- @@ -622,6 +657,7 @@ public: int indexAccel = -1) { m_renderer->DrawRadioButton(dc, label, bitmap, rect, flags, align, indexAccel); } +#if wxUSE_TOOLBAR virtual void DrawToolBarButton(wxDC& dc, const wxString& label, const wxBitmap& bitmap, @@ -630,6 +666,7 @@ public: long style = 0, int tbarStyle = 0) { m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); } +#endif // wxUSE_TOOLBAR virtual void DrawTextLine(wxDC& dc, const wxString& text, const wxRect& rect, @@ -649,6 +686,8 @@ public: int accel = -1) { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); } +#if wxUSE_SLIDER + virtual void DrawSliderShaft(wxDC& dc, const wxRect& rect, int lenThumb, @@ -674,7 +713,9 @@ public: long style = 0) { m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient, start, end, start, flags, style); } +#endif // wxUSE_SLIDER +#if wxUSE_MENUS virtual void DrawMenuBarItem(wxDC& dc, const wxRect& rect, const wxString& label, @@ -695,12 +736,15 @@ public: wxCoord y, const wxMenuGeometryInfo& geomInfo) { m_renderer->DrawMenuSeparator(dc, y, geomInfo); } +#endif // wxUSE_MENUS +#if wxUSE_STATUSBAR virtual void DrawStatusField(wxDC& dc, const wxRect& rect, const wxString& label, int flags = 0, int style = 0) { m_renderer->DrawStatusField(dc, rect, label, flags, style); } +#endif // wxUSE_STATUSBAR virtual void DrawFrameTitleBar(wxDC& dc, const wxRect& rect, @@ -749,6 +793,7 @@ public: virtual bool AreScrollbarsInsideBorder() const { return m_renderer->AreScrollbarsInsideBorder(); } +#if wxUSE_SCROLLBAR virtual wxSize GetScrollbarArrowSize() const { return m_renderer->GetScrollbarArrowSize(); } virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar, @@ -766,6 +811,8 @@ public: virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord) { return m_renderer->PixelToScrollbar(scrollbar, coord); } +#endif // wxUSE_SCROLLBAR + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) { return m_renderer->GetListboxItemHeight(fontHeight); } virtual wxSize GetCheckBitmapSize() const @@ -780,6 +827,7 @@ public: virtual wxSize GetToolBarMargin() const { return m_renderer->GetToolBarMargin(); } +#if wxUSE_TEXTCTRL virtual wxRect GetTextTotalArea(const wxTextCtrl *text, const wxRect& rect) const { return m_renderer->GetTextTotalArea(text, rect); } @@ -787,14 +835,17 @@ public: const wxRect& rect, wxCoord *extraSpaceBeyond) const { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); } +#endif // wxUSE_TEXTCTRL virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); } virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); } +#if wxUSE_SLIDER virtual wxCoord GetSliderDim() const { return m_renderer->GetSliderDim(); } virtual wxCoord GetSliderTickLen() const { return m_renderer->GetSliderTickLen(); } + virtual wxRect GetSliderShaftRect(const wxRect& rect, int lenThumb, wxOrientation orient, @@ -804,15 +855,23 @@ public: int lenThumb, wxOrientation orient) const { return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); } +#endif // wxUSE_SLIDER + virtual wxSize GetProgressBarStep() const { return m_renderer->GetProgressBarStep(); } + +#if wxUSE_MENUS virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const { return m_renderer->GetMenuBarItemSize(sizeText); } virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, const wxMenu& menu) const { return m_renderer->GetMenuGeometry(win, menu); } +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const { return m_renderer->GetStatusBarBorders(borderBetweenFields); } +#endif // wxUSE_STATUSBAR virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const { return m_renderer->GetFrameClientArea(rect, flags); } virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const @@ -892,10 +951,13 @@ public: wxStretch stretch = wxSTRETCH_NOT); private: + +#if wxUSE_LISTBOX // common part of DrawItems() and DrawCheckItems() void DoDrawItems(const wxListBox *listbox, size_t itemFirst, size_t itemLast, bool isCheckLbox = false); +#endif // wxUSE_LISTBOX wxWindow *m_window; wxRenderer *m_renderer; diff --git a/include/wx/univ/scrtimer.h b/include/wx/univ/scrtimer.h index 7e4e8bdd05..a94c528f7f 100644 --- a/include/wx/univ/scrtimer.h +++ b/include/wx/univ/scrtimer.h @@ -14,6 +14,10 @@ // NB: this class is implemented in scrolbar.cpp +#include "wx/defs.h" + +#if wxUSE_TIMER + #include "wx/timer.h" // ---------------------------------------------------------------------------- @@ -42,4 +46,6 @@ protected: bool m_skipNext; }; +#endif // wxUSE_TIMER + #endif // _WX_UNIV_SCRTIMER_H diff --git a/include/wx/univ/window.h b/include/wx/univ/window.h index 65f24a8000..fe6a23f7bd 100644 --- a/include/wx/univ/window.h +++ b/include/wx/univ/window.h @@ -18,10 +18,17 @@ class WXDLLEXPORT wxControlRenderer; class WXDLLEXPORT wxEventLoop; -class WXDLLEXPORT wxMenu; -class WXDLLEXPORT wxMenuBar; + +#if wxUSE_MENUS + class WXDLLEXPORT wxMenu; + class WXDLLEXPORT wxMenuBar; +#endif // wxUSE_MENUS + class WXDLLEXPORT wxRenderer; -class WXDLLEXPORT wxScrollBar; + +#if wxUSE_SCROLLBAR + class WXDLLEXPORT wxScrollBar; +#endif // wxUSE_SCROLLBAR #ifdef __WXX11__ #define wxUSE_TWO_WINDOWS 1 @@ -125,11 +132,13 @@ public: // set the "highlighted" flag and return true if it changed virtual bool SetCurrent(bool doit = true); +#if wxUSE_SCROLLBAR // get the scrollbar (may be NULL) for the given orientation wxScrollBar *GetScrollbar(int orient) const { return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz; } +#endif // wxUSE_SCROLLBAR // methods used by wxColourScheme to choose the colours for this window // -------------------------------------------------------------------- @@ -256,9 +265,12 @@ public: #endif // __WXMSW__ private: + +#if wxUSE_SCROLLBAR // the window scrollbars wxScrollBar *m_scrollbarHorz, *m_scrollbarVert; +#endif // wxUSE_SCROLLBAR #if wxUSE_MENUS // the current modal event loop for the popup menu we show or NULL diff --git a/src/common/image.cpp b/src/common/image.cpp index 11e464a43c..2117d2a209 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1459,7 +1459,9 @@ bool wxImage::HasOption(const wxString& name) const // image I/O // ---------------------------------------------------------------------------- -bool wxImage::LoadFile( const wxString& filename, long type, int index ) +bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), + long WXUNUSED_UNLESS_STREAMS(type), + int WXUNUSED_UNLESS_STREAMS(index) ) { #if wxUSE_STREAMS if (wxFileExists(filename)) @@ -1479,7 +1481,9 @@ bool wxImage::LoadFile( const wxString& filename, long type, int index ) #endif // wxUSE_STREAMS } -bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype, int index ) +bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), + const wxString& WXUNUSED_UNLESS_STREAMS(mimetype), + int WXUNUSED_UNLESS_STREAMS(index) ) { #if wxUSE_STREAMS if (wxFileExists(filename)) @@ -1517,7 +1521,8 @@ bool wxImage::SaveFile( const wxString& filename ) const return false; } -bool wxImage::SaveFile( const wxString& filename, int type ) const +bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), + int WXUNUSED_UNLESS_STREAMS(type) ) const { #if wxUSE_STREAMS wxCHECK_MSG( Ok(), false, wxT("invalid image") ); @@ -1536,7 +1541,8 @@ bool wxImage::SaveFile( const wxString& filename, int type ) const return false; } -bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) const +bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), + const wxString& WXUNUSED_UNLESS_STREAMS(mimetype) ) const { #if wxUSE_STREAMS wxCHECK_MSG( Ok(), false, wxT("invalid image") ); @@ -1555,22 +1561,23 @@ bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) con return false; } -bool wxImage::CanRead( const wxString &name ) +bool wxImage::CanRead( const wxString& WXUNUSED_UNLESS_STREAMS(name) ) { #if wxUSE_STREAMS - wxFileInputStream stream(name); - return CanRead(stream); + wxFileInputStream stream(name); + return CanRead(stream); #else - return false; + return false; #endif } -int wxImage::GetImageCount( const wxString &name, long type ) +int wxImage::GetImageCount( const wxString& WXUNUSED_UNLESS_STREAMS(name), + long WXUNUSED_UNLESS_STREAMS(type) ) { #if wxUSE_STREAMS - wxFileInputStream stream(name); - if (stream.Ok()) - return GetImageCount(stream, type); + wxFileInputStream stream(name); + if (stream.Ok()) + return GetImageCount(stream, type); #endif return 0; diff --git a/src/common/init.cpp b/src/common/init.cpp index 697aea6656..b01d39cd9b 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: common/init.cpp +// Name: src/common/init.cpp // Purpose: initialisation for the library // Author: Vadim Zeitlin // Modified by: @@ -20,7 +20,7 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop + #pragma hdrstop #endif //__BORLANDC__ #ifndef WX_PRECOMP diff --git a/src/common/pickerbase.cpp b/src/common/pickerbase.cpp index 3187ccdfe9..ce5c4a2d55 100644 --- a/src/common/pickerbase.cpp +++ b/src/common/pickerbase.cpp @@ -24,6 +24,11 @@ #pragma hdrstop #endif +#if wxUSE_COLOURPICKERCTRL || \ + wxUSE_DIRPICKERCTRL || \ + wxUSE_FILEPICKERCTRL || \ + wxUSE_FONTPICKERCTRL + #include "wx/pickerbase.h" #ifndef WX_PRECOMP @@ -200,3 +205,5 @@ void wxPickerBase::SetInternalMargin(int newmargin) { m_margin = newmargin; } + +#endif // Any picker in use diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 6438447f92..de7f0683b6 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -462,10 +462,10 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) wxPoint pos = event.GetPosition(); // in non-Univ ports the system manages scrollbars for us -#ifdef __WXUNIVERSAL__ +#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR // scrollbar on which the click occurred wxWindow *sbar = NULL; -#endif // __WXUNIVERSAL__ +#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR wxWindow *win = (wxWindow *)event.GetEventObject(); @@ -498,7 +498,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) } break; -#ifdef __WXUNIVERSAL__ +#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR case wxHT_WINDOW_HORZ_SCROLLBAR: sbar = win->GetScrollbar(wxHORIZONTAL); break; @@ -506,7 +506,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) case wxHT_WINDOW_VERT_SCROLLBAR: sbar = win->GetScrollbar(wxVERTICAL); break; -#endif // __WXUNIVERSAL__ +#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR default: // forgot to update the switch after adding a new hit test code? @@ -523,7 +523,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) break; } -#ifdef __WXUNIVERSAL__ +#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR if ( sbar ) { // translate the event coordinates to the scrollbar ones @@ -536,7 +536,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) (void)sbar->GetEventHandler()->ProcessEvent(event2); } -#endif // __WXUNIVERSAL__ +#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR } // ---------------------------------------------------------------------------- diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 42e5c5cd03..4bafd05df1 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -913,15 +913,18 @@ wxRegisterId (long id) wxCurrentId = id + 1; } -#if wxUSE_MENUS - // ---------------------------------------------------------------------------- // Menu accelerators related functions // ---------------------------------------------------------------------------- wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out) { +#if wxUSE_MENUS wxString s = wxMenuItem::GetLabelFromText(in); +#else + wxString str(in); + wxString s = wxStripMenuCodes(str); +#endif // wxUSE_MENUS if ( out ) { // go smash their buffer if it's not big enough - I love char * params @@ -974,8 +977,6 @@ wxString wxStripMenuCodes(const wxString& in) return out; } -#endif // wxUSE_MENUS - // ---------------------------------------------------------------------------- // Window search functions // ---------------------------------------------------------------------------- @@ -1010,12 +1011,12 @@ int wxFindMenuItemId (wxFrame * frame, const wxString& menuString, const wxString& itemString) { #if wxUSE_MENUS - wxMenuBar *menuBar = frame->GetMenuBar (); - if ( menuBar ) - return menuBar->FindMenuItem (menuString, itemString); + wxMenuBar *menuBar = frame->GetMenuBar (); + if ( menuBar ) + return menuBar->FindMenuItem (menuString, itemString); #endif // wxUSE_MENUS - return wxNOT_FOUND; + return wxNOT_FOUND; } // Try to find the deepest child that contains 'pt'. diff --git a/src/generic/mdig.cpp b/src/generic/mdig.cpp index 4f002030ea..b6a043aad3 100644 --- a/src/generic/mdig.cpp +++ b/src/generic/mdig.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_MDI + #include "wx/generic/mdig.h" #ifndef WX_PRECOMP @@ -812,4 +814,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxGenericMDIParentFrame) IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxGenericMDIChildFrame) IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxGenericMDIClientWindow) -#endif +#endif // wxUSE_GENERIC_MDI_AS_NATIVE + +#endif // wxUSE_MDI \ No newline at end of file diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 0ef3d052f3..f63df3e469 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -70,6 +70,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL ); +#if wxUSE_STATBMP // 1) icon if (style & wxICON_MASK) { @@ -102,11 +103,14 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, else icon_text->Add( icon, 0, wxCENTER ); } +#endif // wxUSE_STATBMP +#if wxUSE_STATTEXT // 2) text icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 ); topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 ); +#endif // wxUSE_STATTEXT #if wxUSE_STATLINE // 3) static line diff --git a/src/generic/regiong.cpp b/src/generic/regiong.cpp index c81364b059..e5595ff19e 100644 --- a/src/generic/regiong.cpp +++ b/src/generic/regiong.cpp @@ -17,7 +17,7 @@ #pragma hdrstop #endif -#include "wx/generic/region.h" +#include "wx/region.h" #ifndef WX_PRECOMP #include "wx/utils.h" @@ -631,14 +631,17 @@ SOFTWARE. */ /* Create a new empty region */ -Region REGION:: -XCreateRegion(void) +Region REGION::XCreateRegion(void) { - Region temp; + Region temp = new REGION; - if (! (temp = new REGION)) + if (!temp) return (Region) NULL; - if (! (temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX )))) { + + temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX )); + + if (!temp->rects) + { free((char *) temp); return (Region) NULL; } @@ -651,10 +654,7 @@ XCreateRegion(void) return( temp ); } -bool REGION:: -XClipBox( - Region r, - wxRect *rect) +bool REGION::XClipBox(Region r, wxRect *rect) { rect->x = r->extents.x1; rect->y = r->extents.y1; @@ -887,9 +887,10 @@ miRegionCopy( { BOX *prevRects = dstrgn->rects; - if (! (dstrgn->rects = (BOX *) + dstrgn->rects = (BOX *) realloc((char *) dstrgn->rects, - (unsigned) rgn->numRects * (sizeof(BOX))))) + (unsigned) rgn->numRects * (sizeof(BOX))); + if (!dstrgn->rects) { free(prevRects); return; @@ -1156,8 +1157,10 @@ miRegionOp( */ newReg->size = wxMax(reg1->numRects,reg2->numRects) * 2; - if (! (newReg->rects = (BoxPtr) - malloc ((unsigned) (sizeof(BoxRec) * newReg->size)))) { + newReg->rects = (BoxPtr)malloc((unsigned) (sizeof(BoxRec) * newReg->size)); + + if (!newReg->rects) + { newReg->size = 0; return; } @@ -1786,11 +1789,7 @@ miSubtractO ( *----------------------------------------------------------------------- */ -bool REGION:: -XSubtractRegion( - Region regM, - Region regS, - register Region regD) +bool REGION::XSubtractRegion(Region regM, Region regS, register Region regD) { /* check for trivial reject */ if ( (!(regM->numRects)) || (!(regS->numRects)) || @@ -1814,13 +1813,16 @@ XSubtractRegion( return true; } -bool REGION:: -XXorRegion(Region sra, Region srb, Region dr) +bool REGION::XXorRegion(Region sra, Region srb, Region dr) { - Region tra, trb; + Region tra = XCreateRegion(); + + wxCHECK_MSG( tra, false, wxT("region not created") ); + + Region trb = XCreateRegion(); + + wxCHECK_MSG( trb, false, wxT("region not created") ); - if ((! (tra = XCreateRegion())) || (! (trb = XCreateRegion()))) - return 0; (void) XSubtractRegion(sra,srb,tra); (void) XSubtractRegion(srb,sra,trb); (void) XUnionRegion(tra,trb,dr); @@ -1833,9 +1835,7 @@ XXorRegion(Region sra, Region srb, Region dr) * Check to see if the region is empty. Assumes a region is passed * as a parameter */ -bool REGION:: -XEmptyRegion( - Region r) +bool REGION::XEmptyRegion(Region r) { if( r->numRects == 0 ) return true; else return false; @@ -1844,8 +1844,7 @@ XEmptyRegion( /* * Check to see if two regions are equal */ -bool REGION:: -XEqualRegion(Region r1, Region r2) +bool REGION::XEqualRegion(Region r1, Region r2) { int i; @@ -1864,10 +1863,7 @@ XEqualRegion(Region r1, Region r2) return true; } -bool REGION:: -XPointInRegion( - Region pRegion, - int x, int y) +bool REGION::XPointInRegion(Region pRegion, int x, int y) { int i; @@ -1883,11 +1879,10 @@ XPointInRegion( return false; } -wxRegionContain REGION:: -XRectInRegion( - register Region region, - int rx, int ry, - unsigned int rwidth, unsigned int rheight) +wxRegionContain REGION::XRectInRegion(register Region region, + int rx, int ry, + unsigned int rwidth, + unsigned int rheight) { register BoxPtr pbox; register BoxPtr pboxEnd; diff --git a/src/univ/ctrlrend.cpp b/src/univ/ctrlrend.cpp index f1c35bb27d..cda4d045a1 100644 --- a/src/univ/ctrlrend.cpp +++ b/src/univ/ctrlrend.cpp @@ -127,6 +127,8 @@ void wxRenderer::StandardDrawTextLine(wxDC& dc, // wxRenderer: scrollbar geometry // ---------------------------------------------------------------------------- +#if wxUSE_SCROLLBAR + /* static */ void wxRenderer::StandardScrollBarThumbSize(wxCoord length, int thumbPos, @@ -386,6 +388,8 @@ wxHitTest wxRenderer::StandardHitTestScrollbar(const wxScrollBar *scrollbar, } } +#endif // wxUSE_SCROLLBAR + wxRenderer::~wxRenderer() { } @@ -500,11 +504,13 @@ void wxControlRenderer::DrawBitmap(wxDC &dc, } } } +#if wxUSE_IMAGE else if ( stretch & wxEXPAND ) { // stretch bitmap to fill the entire control bmp = wxBitmap(wxImage(bmp.ConvertToImage()).Scale(rect.width, rect.height)); } +#endif // wxUSE_IMAGE else // not stretched, not tiled { if ( alignment & wxALIGN_RIGHT ) @@ -538,6 +544,8 @@ void wxControlRenderer::DrawBitmap(wxDC &dc, dc.DrawBitmap(bmp, x, y, true /* use mask */); } +#if wxUSE_SCROLLBAR + void wxControlRenderer::DrawScrollbar(const wxScrollBar *scrollbar, int WXUNUSED(thumbPosOld)) { @@ -648,6 +656,8 @@ void wxControlRenderer::DrawScrollbar(const wxScrollBar *scrollbar, } } +#endif // wxUSE_SCROLLBAR + void wxControlRenderer::DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { wxASSERT_MSG( x1 == x2 || y1 == y2, diff --git a/src/univ/framuniv.cpp b/src/univ/framuniv.cpp index 2ce9b25aa4..53dd59c937 100644 --- a/src/univ/framuniv.cpp +++ b/src/univ/framuniv.cpp @@ -49,12 +49,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) // ---------------------------------------------------------------------------- bool wxFrame::Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; diff --git a/src/univ/scrarrow.cpp b/src/univ/scrarrow.cpp index 4a47d3fb00..76347bfa07 100644 --- a/src/univ/scrarrow.cpp +++ b/src/univ/scrarrow.cpp @@ -45,7 +45,9 @@ struct wxScrollArrowCaptureData m_arrowPressed = wxScrollArrows::Arrow_None; m_window = NULL; m_btnCapture = -1; +#if wxUSE_TIMER m_timerScroll = NULL; +#endif // wxUSE_TIMER } ~wxScrollArrowCaptureData() @@ -53,7 +55,9 @@ struct wxScrollArrowCaptureData if ( m_window ) m_window->ReleaseMouse(); +#if wxUSE_TIMER delete m_timerScroll; +#endif // wxUSE_TIMER } // the arrow being held pressed (may be Arrow_None) @@ -65,14 +69,18 @@ struct wxScrollArrowCaptureData // the window which has captured the mouse wxWindow *m_window; +#if wxUSE_TIMER // the timer for generating the scroll events wxScrollTimer *m_timerScroll; +#endif }; // ---------------------------------------------------------------------------- // wxScrollArrowTimer: a wxScrollTimer which calls OnArrow() // ---------------------------------------------------------------------------- +#if wxUSE_TIMER + class wxScrollArrowTimer : public wxScrollTimer { public: @@ -95,6 +103,8 @@ protected: wxScrollArrows::Arrow m_arrow; }; +#endif // wxUSE_TIMER + // ============================================================================ // implementation of wxScrollArrows // ============================================================================ @@ -166,6 +176,7 @@ bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const arrow = m_control->HitTest(event.GetPosition()); } +#if wxUSE_TIMER if ( m_captureData && m_captureData->m_timerScroll) { // the mouse is captured, we may want to pause scrolling if it goes @@ -199,6 +210,7 @@ bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const return false; } +#endif // wxUSE_TIMER // reset the wxCONTROL_CURRENT flag for the arrows which don't have the // mouse and set it for the one which has @@ -242,22 +254,28 @@ bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const m_captureData->m_window = m_control->GetWindow(); m_captureData->m_window->CaptureMouse(); - // start scrolling +#if wxUSE_TIMER + // start scrolling wxScrollArrowTimer *tmpTimerScroll = new wxScrollArrowTimer(m_control, arrow); +#endif // wxUSE_TIMER - // Because in some cases wxScrollArrowTimer can cause - // m_captureData to be destructed we need to test if it + // Because in some cases wxScrollArrowTimer can cause + // m_captureData to be destructed we need to test if it // is still valid before using. if (m_captureData) { +#if wxUSE_TIMER m_captureData->m_timerScroll = tmpTimerScroll; +#endif // wxUSE_TIMER m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, true); } else { +#if wxUSE_TIMER delete tmpTimerScroll; +#endif // wxUSE_TIMER } } //else: mouse already captured, nothing to do diff --git a/src/univ/scrolbar.cpp b/src/univ/scrolbar.cpp index 3f648b0ab0..f446c73f34 100644 --- a/src/univ/scrolbar.cpp +++ b/src/univ/scrolbar.cpp @@ -907,6 +907,8 @@ bool wxStdScrollBarInputHandler::HandleMouseMove(wxInputConsumer *consumer, #endif // wxUSE_SCROLLBAR +#if wxUSE_TIMER + // ---------------------------------------------------------------------------- // wxScrollTimer // ---------------------------------------------------------------------------- @@ -949,3 +951,5 @@ void wxScrollTimer::Notify() (void)DoNotify(); } } + +#endif // wxUSE_TIMER diff --git a/src/univ/scrthumb.cpp b/src/univ/scrthumb.cpp index 2852a6f280..a6c0e02284 100644 --- a/src/univ/scrthumb.cpp +++ b/src/univ/scrthumb.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: univ/scrthumb.cpp +// Name: src/univ/scrthumb.cpp // Purpose: wxScrollThumb and related classes // Author: Vadim Zeitlin // Modified by: @@ -25,9 +25,9 @@ #ifndef WX_PRECOMP #include "wx/window.h" - #include "wx/renderer.h" #endif // WX_PRECOMP +#include "wx/renderer.h" #include "wx/univ/scrtimer.h" #include "wx/univ/scrthumb.h" @@ -59,7 +59,9 @@ struct WXDLLEXPORT wxScrollThumbCaptureData m_window->ReleaseMouse(); } +#if wxUSE_TIMER delete m_timerScroll; +#endif // wxUSE_TIMER } // the thumb part being held pressed @@ -83,6 +85,8 @@ struct WXDLLEXPORT wxScrollThumbCaptureData // wxScrollTimer: the timer used when the arrow is kept pressed // ---------------------------------------------------------------------------- +#if wxUSE_TIMER + class wxScrollThumbTimer : public wxScrollTimer { public: @@ -120,6 +124,8 @@ protected: int m_inc; }; +#endif // wxUSE_TIMER + // ============================================================================ // implementation // ============================================================================ @@ -192,6 +198,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const // generate an additional event if we start dragging the thumb m_control->OnThumbDragStart(GetThumbPos(event)); } +#if wxUSE_TIMER else // not the thumb { // start timer for auto scrolling when the user presses the mouse @@ -199,6 +206,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const m_captureData->m_timerScroll = new wxScrollThumbTimer(m_control, shaftPart); } +#endif // wxUSE_TIMER } // release mouse if the *same* button went up else if ( HasCapture() && (btn == m_captureData->m_btnCapture) ) diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index 5d24b5c657..e385744196 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -166,6 +166,7 @@ public: wxAlignment align = wxALIGN_LEFT, int indexAccel = -1); +#if wxUSE_TOOLBAR virtual void DrawToolBarButton(wxDC& dc, const wxString& label, const wxBitmap& bitmap, @@ -173,6 +174,7 @@ public: int flags = 0, long style = 0, int tbarStyle = 0); +#endif // wxUSE_TOOLBAR virtual void DrawTextLine(wxDC& dc, const wxString& text, @@ -189,6 +191,7 @@ public: int flags = 0, int indexAccel = -1); +#if wxUSE_SLIDER virtual void DrawSliderShaft(wxDC& dc, const wxRect& rect, int lenThumb, @@ -213,7 +216,9 @@ public: { // we don't have the ticks in GTK version } +#endif // wxUSE_SLIDER +#if wxUSE_MENUS virtual void DrawMenuBarItem(wxDC& dc, const wxRect& rect, const wxString& label, @@ -230,11 +235,14 @@ public: virtual void DrawMenuSeparator(wxDC& dc, wxCoord y, const wxMenuGeometryInfo& geomInfo); +#endif // wxUSE_MENUS +#if wxUSE_STATUSBAR virtual void DrawStatusField(wxDC& dc, const wxRect& rect, const wxString& label, int flags = 0, int style = 0); +#endif // wxUSE_STATUSBAR virtual void DrawFrameTitleBar(wxDC& dc, const wxRect& rect, @@ -281,6 +289,7 @@ public: // geometry and hit testing virtual wxSize GetScrollbarArrowSize() const { return m_sizeScrollbarArrow; } +#if wxUSE_SCROLLBAR virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar, wxScrollBar::Element elem, int thumbPos = -1) const; @@ -290,6 +299,8 @@ public: virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar, int thumbPos = -1); virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord); +#endif // wxUSE_SCROLLBAR + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) { return fontHeight + 2; } virtual wxSize GetCheckBitmapSize() const @@ -304,15 +315,18 @@ public: virtual wxSize GetToolBarMargin() const { return wxSize(6, 6); } +#if wxUSE_TEXTCTRL virtual wxRect GetTextTotalArea(const wxTextCtrl *text, const wxRect& rect) const; virtual wxRect GetTextClientArea(const wxTextCtrl *text, const wxRect& rect, wxCoord *extraSpaceBeyond) const; +#endif // wxUSE_TEXTCTRL virtual wxSize GetTabIndent() const { return wxSize(2, 2); } virtual wxSize GetTabPadding() const { return wxSize(6, 6); } +#if wxUSE_SLIDER virtual wxCoord GetSliderDim() const { return 15; } virtual wxCoord GetSliderTickLen() const { return 0; } virtual wxRect GetSliderShaftRect(const wxRect& rect, @@ -322,13 +336,19 @@ public: virtual wxSize GetSliderThumbSize(const wxRect& rect, int lenThumb, wxOrientation orient) const; +#endif // wxUSE_SLIDER + virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); } +#if wxUSE_MENUS virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const; virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, const wxMenu& menu) const; +#endif // wxUSE_MENUS +#if wxUSE_STATUSBAR virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const; +#endif // wxUSE_STATUSBAR // helpers for "wxBitmap wxColourScheme::Get()" void DrawCheckBitmap(wxDC& dc, const wxRect& rect); @@ -400,6 +420,7 @@ protected: // rect is drawn with DrawAntiShadedRect() and not DrawShadedRect()) void DrawAntiRaisedBorder(wxDC& dc, wxRect *rect); +#if wxUSE_SCROLLBAR // returns the size of the arrow for the scrollbar (depends on // orientation) wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar) const @@ -417,6 +438,7 @@ protected: return size; } +#endif // wxUSE_SCROLLBAR // get the line wrap indicator bitmap wxBitmap GetLineWrapBitmap() const; @@ -515,6 +537,8 @@ protected: wxGTKRenderer *m_renderer; }; +#if wxUSE_SCROLLBAR + class wxGTKScrollBarInputHandler : public wxStdScrollBarInputHandler { public: @@ -549,6 +573,10 @@ protected: } }; +#endif // wxUSE_SCROLLBAR + +#if wxUSE_CHECKBOX + class wxGTKCheckboxInputHandler : public wxStdCheckboxInputHandler { public: @@ -560,6 +588,10 @@ public: bool pressed); }; +#endif // wxUSE_CHECKBOX + +#if wxUSE_TEXTCTRL + class wxGTKTextCtrlInputHandler : public wxStdTextCtrlInputHandler { public: @@ -571,6 +603,8 @@ public: bool pressed); }; +#endif // wxUSE_TEXTCTRL + // ---------------------------------------------------------------------------- // wxGTKColourScheme: uses the standard GTK colours // ---------------------------------------------------------------------------- @@ -705,14 +739,18 @@ wxInputHandler *wxGTKTheme::GetDefaultInputHandler() wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control) { - wxInputHandler *handler; + wxInputHandler *handler = NULL; int n = m_handlerNames.Index(control); if ( n == wxNOT_FOUND ) { // create a new handler if ( control == wxINP_HANDLER_SCROLLBAR ) + { +#if wxUSE_SCROLLBAR handler = new wxGTKScrollBarInputHandler(m_renderer, GetDefaultInputHandler()); +#endif // wxUSE_SCROLLBAR + } #if wxUSE_BUTTON else if ( control == wxINP_HANDLER_BUTTON ) handler = new wxStdButtonInputHandler(GetDefaultInputHandler()); @@ -755,7 +793,8 @@ wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control) #endif // wxUSE_TOOLBAR else if ( control == wxINP_HANDLER_TOPLEVEL ) handler = new wxStdFrameInputHandler(GetDefaultInputHandler()); - else + + if(!handler) handler = GetDefaultInputHandler(); n = m_handlerNames.Add(control); @@ -798,9 +837,12 @@ wxColour wxGTKColourScheme::GetBackground(wxWindow *win) const // and for the states for which we don't have any specific colours if ( !col.Ok() || (flags != 0) ) { +#if wxUSE_SCROLLBAR if ( wxDynamicCast(win, wxScrollBar) ) col = Get(SCROLLBAR); - else if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() ) + else +#endif //wxUSE_SCROLLBAR + if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() ) col = Get(CONTROL_CURRENT); else if ( flags & wxCONTROL_PRESSED ) col = Get(CONTROL_PRESSED); @@ -841,6 +883,14 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) const case GAUGE: return Get(CONTROL_CURRENT); + case TITLEBAR: return wxColour(0xaeaaae); + case TITLEBAR_ACTIVE: return wxColour(0x820300); + case TITLEBAR_TEXT: return wxColour(0xc0c0c0); + case TITLEBAR_ACTIVE_TEXT: + return *wxWHITE; + + case DESKTOP: return *wxBLACK; + case MAX: default: wxFAIL_MSG(_T("invalid standard colour")); @@ -1679,6 +1729,7 @@ void wxGTKRenderer::DrawRadioButton(wxDC& dc, flags, align, indexAccel); } +#if wxUSE_TOOLBAR void wxGTKRenderer::DrawToolBarButton(wxDC& dc, const wxString& label, const wxBitmap& bitmap, @@ -1725,11 +1776,14 @@ void wxGTKRenderer::DrawToolBarButton(wxDC& dc, } } } +#endif // wxUSE_TOOLBAR // ---------------------------------------------------------------------------- // text control // ---------------------------------------------------------------------------- +#if wxUSE_TEXTCTRL + wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text), const wxRect& rect) const { @@ -1759,6 +1813,8 @@ wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text, return rectText; } +#endif // wxUSE_TEXTCTRL + void wxGTKRenderer::DrawTextLine(wxDC& dc, const wxString& text, const wxRect& rect, @@ -1883,11 +1939,21 @@ void wxGTKRenderer::DrawTab(wxDC& dc, dcMem.SetFont(dc.GetFont()); dcMem.SetTextForeground(dc.GetTextForeground()); dcMem.Clear(); - bitmapRotated = wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) ); + bitmapRotated = +#if wxUSE_IMAGE + wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) ) +#else + bitmap +#endif // wxUSE_IMAGE + ; dcMem.DrawLabel(label, bitmapRotated, rectLabel, wxALIGN_CENTRE, indexAccel); dcMem.SelectObject(wxNullBitmap); bitmapMem = bitmapMem.GetSubBitmap(rectLabel); - bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT)); +#if wxUSE_IMAGE + bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT)) +#endif + ; + dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false); } else @@ -1986,6 +2052,8 @@ void wxGTKRenderer::DrawTab(wxDC& dc, } } +#if wxUSE_SLIDER + // ---------------------------------------------------------------------------- // slider // ---------------------------------------------------------------------------- @@ -2075,6 +2143,10 @@ void wxGTKRenderer::DrawSliderThumb(wxDC& dc, DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight); } +#endif // wxUSE_SLIDER + +#if wxUSE_MENUS + // ---------------------------------------------------------------------------- // menu and menubar // ---------------------------------------------------------------------------- @@ -2340,6 +2412,10 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win, return gi; } +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // ---------------------------------------------------------------------------- // status bar // ---------------------------------------------------------------------------- @@ -2357,6 +2433,8 @@ void wxGTKRenderer::DrawStatusField(wxDC& WXUNUSED(dc), { } +#endif // wxUSE_STATUSBAR + // ---------------------------------------------------------------------------- // combobox // ---------------------------------------------------------------------------- @@ -2780,6 +2858,7 @@ void wxGTKRenderer::DrawScrollCorner(wxDC& dc, const wxRect& rect) DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect); } +#if wxUSE_SCROLLBAR wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar, wxScrollBar::Element elem, int thumbPos) const @@ -2822,6 +2901,7 @@ int wxGTKRenderer::PixelToScrollbar(const wxScrollBar *scrollbar, return StandardPixelToScrollbar(scrollbar, coord, GetScrollbarArrowSize(scrollbar)); } +#endif // wxUSE_SCROLLBAR // ---------------------------------------------------------------------------- // size adjustments @@ -2859,6 +2939,7 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window) } } else #endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN +#if wxUSE_SCROLLBAR if ( wxDynamicCast(window, wxScrollBar) ) { // we only set the width of vert scrollbars and height of the @@ -2869,6 +2950,7 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window) size->x = m_sizeScrollbarArrow.x; } else +#endif // wxUSE_SCROLLBAR { // take into account the border width wxRect rectBorder = GetBorderDimensions(window->GetBorder()); @@ -3294,6 +3376,8 @@ bool wxGTKInputHandler::HandleMouseMove(wxInputConsumer *control, return true; } +#if wxUSE_CHECKBOX + // ---------------------------------------------------------------------------- // wxGTKCheckboxInputHandler // ---------------------------------------------------------------------------- @@ -3316,6 +3400,10 @@ bool wxGTKCheckboxInputHandler::HandleKey(wxInputConsumer *control, return false; } +#endif // wxUSE_CHECKBOX + +#if wxUSE_TEXTCTRL + // ---------------------------------------------------------------------------- // wxGTKTextCtrlInputHandler // ---------------------------------------------------------------------------- @@ -3409,3 +3497,5 @@ bool wxGTKTextCtrlInputHandler::HandleKey(wxInputConsumer *control, return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed); } + +#endif // wxUSE_TEXTCTRL diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 8b9b052077..130c5e4ced 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -243,6 +243,7 @@ public: int flags = 0, wxAlignment align = wxALIGN_LEFT, int indexAccel = -1); +#if wxUSE_TOOLBAR virtual void DrawToolBarButton(wxDC& dc, const wxString& label, const wxBitmap& bitmap, @@ -250,6 +251,7 @@ public: int flags = 0, long style = 0, int tbarStyle = 0); +#endif // wxUSE_TOOLBAR virtual void DrawTextLine(wxDC& dc, const wxString& text, const wxRect& rect, @@ -265,6 +267,7 @@ public: int flags = 0, int indexAccel = -1); +#if wxUSE_SLIDER virtual void DrawSliderShaft(wxDC& dc, const wxRect& rect, int lenThumb, @@ -286,7 +289,9 @@ public: int step = 1, int flags = 0, long style = 0); +#endif // wxUSE_SLIDER +#if wxUSE_MENUS virtual void DrawMenuBarItem(wxDC& dc, const wxRect& rect, const wxString& label, @@ -303,11 +308,14 @@ public: virtual void DrawMenuSeparator(wxDC& dc, wxCoord y, const wxMenuGeometryInfo& geomInfo); +#endif // wxUSE_MENUS +#if wxUSE_STATUSBAR virtual void DrawStatusField(wxDC& dc, const wxRect& rect, const wxString& label, int flags = 0, int style = 0); +#endif // wxUSE_STATUSBAR // titlebars virtual void DrawFrameTitleBar(wxDC& dc, @@ -352,6 +360,8 @@ public: virtual wxSize GetScrollbarArrowSize() const { return m_sizeScrollbarArrow; } + +#if wxUSE_SCROLLBAR virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar, wxScrollBar::Element elem, int thumbPos = -1) const; @@ -361,6 +371,8 @@ public: virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar, int thumbPos = -1); virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord); +#endif // wxUSE_SCROLLBAR + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) { return fontHeight + 2; } virtual wxSize GetCheckBitmapSize() const @@ -375,15 +387,19 @@ public: virtual wxSize GetToolBarMargin() const { return wxSize(4, 4); } +#if wxUSE_TEXTCTRL virtual wxRect GetTextTotalArea(const wxTextCtrl *text, const wxRect& rect) const; virtual wxRect GetTextClientArea(const wxTextCtrl *text, const wxRect& rect, wxCoord *extraSpaceBeyond) const; +#endif // wxUSE_TEXTCTRL virtual wxSize GetTabIndent() const { return wxSize(2, 2); } virtual wxSize GetTabPadding() const { return wxSize(6, 5); } +#if wxUSE_SLIDER + virtual wxCoord GetSliderDim() const { return SLIDER_THUMB_LENGTH + 2*BORDER_THICKNESS; } virtual wxCoord GetSliderTickLen() const { return SLIDER_TICK_LENGTH; } virtual wxRect GetSliderShaftRect(const wxRect& rect, @@ -393,13 +409,19 @@ public: virtual wxSize GetSliderThumbSize(const wxRect& rect, int lenThumb, wxOrientation orient) const; +#endif // wxUSE_SLIDER + virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); } +#if wxUSE_MENUS virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const; virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, const wxMenu& menu) const; +#endif // wxUSE_MENUS +#if wxUSE_STATUSBAR virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const; +#endif // wxUSE_STATUSBAR protected: // helper of DrawLabel() and DrawCheckOrRadioButton() @@ -543,6 +565,7 @@ protected: wxWin32Renderer *m_renderer; }; +#if wxUSE_SCROLLBAR class wxWin32ScrollBarInputHandler : public wxStdScrollBarInputHandler { public: @@ -574,7 +597,9 @@ protected: // we remember the interval of the timer to be able to restart it int m_interval; }; +#endif // wxUSE_SCROLLBAR +#if wxUSE_CHECKBOX class wxWin32CheckboxInputHandler : public wxStdCheckboxInputHandler { public: @@ -585,7 +610,9 @@ public: const wxKeyEvent& event, bool pressed); }; +#endif // wxUSE_CHECKBOX +#if wxUSE_TEXTCTRL class wxWin32TextCtrlInputHandler : public wxStdTextCtrlInputHandler { public: @@ -596,6 +623,7 @@ public: const wxKeyEvent& event, bool pressed); }; +#endif // wxUSE_TEXTCTRL class wxWin32StatusBarInputHandler : public wxStdInputHandler { @@ -633,7 +661,9 @@ public: virtual bool HandleActivation(wxInputConsumer *consumer, bool activated); +#if wxUSE_MENUS void PopupSystemMenu(wxTopLevelWindow *window, const wxPoint& pos) const; +#endif // wxUSE_MENUS private: // was the mouse over the grip last time we checked? @@ -1297,14 +1327,18 @@ wxInputHandler *wxWin32Theme::GetDefaultInputHandler() wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control) { - wxInputHandler *handler; + wxInputHandler *handler = NULL; int n = m_handlerNames.Index(control); if ( n == wxNOT_FOUND ) { // create a new handler if ( control == wxINP_HANDLER_SCROLLBAR ) + { +#if wxUSE_SCROLLBAR handler = new wxWin32ScrollBarInputHandler(m_renderer, GetDefaultInputHandler()); +#endif // wxUSE_SCROLLBAR + } #if wxUSE_BUTTON else if ( control == wxINP_HANDLER_BUTTON ) handler = new wxStdButtonInputHandler(GetDefaultInputHandler()); @@ -1351,7 +1385,8 @@ wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control) #endif // wxUSE_TOOLBAR else if ( control == wxINP_HANDLER_TOPLEVEL ) handler = new wxWin32FrameInputHandler(GetDefaultInputHandler()); - else + + if(!handler) handler = GetDefaultInputHandler(); n = m_handlerNames.Add(control); @@ -1389,10 +1424,14 @@ wxColour wxWin32ColourScheme::GetBackground(wxWindow *win) const if ( !win->ShouldInheritColours() ) { +#if wxUSE_TEXTCTRL wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl); +#endif // wxUSE_TEXTCTRL #if wxUSE_LISTBOX wxListBox* listBox = wxDynamicCast(win, wxListBox); -#endif +#endif // wxUSE_LISTBOX + +#if wxUSE_TEXTCTRL if ( text #if wxUSE_LISTBOX || listBox @@ -1410,6 +1449,7 @@ wxColour wxWin32ColourScheme::GetBackground(wxWindow *win) const } } } +#endif // wxUSE_TEXTCTRL if (!col.Ok()) col = Get(CONTROL); // Most controls should be this colour, not WINDOW @@ -1422,10 +1462,12 @@ wxColour wxWin32ColourScheme::GetBackground(wxWindow *win) const // and for the states for which we don't have any specific colours if ( !col.Ok() || (flags & wxCONTROL_PRESSED) != 0 ) { +#if wxUSE_SCROLLBAR if ( wxDynamicCast(win, wxScrollBar) ) col = Get(flags & wxCONTROL_PRESSED ? SCROLLBAR_PRESSED : SCROLLBAR); else +#endif // wxUSE_SCROLLBAR col = Get(CONTROL); } } @@ -2475,6 +2517,7 @@ void wxWin32Renderer::DrawCheckButton(wxDC& dc, 0); // no focus rect offset for checkboxes } +#if wxUSE_TOOLBAR void wxWin32Renderer::DrawToolBarButton(wxDC& dc, const wxString& label, const wxBitmap& bitmap, @@ -2536,6 +2579,7 @@ void wxWin32Renderer::DrawToolBarButton(wxDC& dc, } // don't draw wxTOOL_STYLE_CONTROL } +#endif // wxUSE_TOOLBAR // ---------------------------------------------------------------------------- // text control @@ -2627,12 +2671,20 @@ void wxWin32Renderer::DrawTab(wxDC& dc, dcMem.SetFont(dc.GetFont()); dcMem.SetTextForeground(dc.GetTextForeground()); dcMem.Clear(); - bitmapRotated = wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) ); + bitmapRotated = +#if wxUSE_IMAGE + wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) ) +#else + bitmap +#endif // wxUSE_IMAGE + ; DrawButtonLabel(dcMem, label, bitmapRotated, rectLabel, flags, wxALIGN_CENTRE, indexAccel); dcMem.SelectObject(wxNullBitmap); bitmapMem = bitmapMem.GetSubBitmap(rectLabel); +#if wxUSE_IMAGE bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT)); +#endif // wxUSE_IMAGE dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false); } else @@ -2737,6 +2789,8 @@ void wxWin32Renderer::DrawTab(wxDC& dc, #undef REVERSE_FOR_VERTICAL } +#if wxUSE_SLIDER + // ---------------------------------------------------------------------------- // slider // ---------------------------------------------------------------------------- @@ -3086,6 +3140,10 @@ void wxWin32Renderer::DrawSliderTicks(wxDC& dc, } } +#endif // wxUSE_SLIDER + +#if wxUSE_MENUS + // ---------------------------------------------------------------------------- // menu and menubar // ---------------------------------------------------------------------------- @@ -3348,6 +3406,10 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win, return gi; } +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // ---------------------------------------------------------------------------- // status bar // ---------------------------------------------------------------------------- @@ -3440,6 +3502,8 @@ void wxWin32Renderer::DrawStatusField(wxDC& dc, DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL); } +#endif // wxUSE_STATUSBAR + // ---------------------------------------------------------------------------- // combobox // ---------------------------------------------------------------------------- @@ -3600,6 +3664,8 @@ void wxWin32Renderer::DrawScrollCorner(wxDC& dc, const wxRect& rect) DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect); } +#if wxUSE_SCROLLBAR + wxRect wxWin32Renderer::GetScrollbarRect(const wxScrollBar *scrollbar, wxScrollBar::Element elem, int thumbPos) const @@ -3631,6 +3697,8 @@ int wxWin32Renderer::PixelToScrollbar(const wxScrollBar *scrollbar, return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow); } +#endif // wxUSE_SCROLLBAR + // ---------------------------------------------------------------------------- // top level windows // ---------------------------------------------------------------------------- @@ -4290,6 +4358,8 @@ wxBitmap wxWin32ArtProvider::CreateBitmap(const wxArtID& id, } +#if wxUSE_TEXTCTRL + // ---------------------------------------------------------------------------- // text control geometry // ---------------------------------------------------------------------------- @@ -4334,6 +4404,8 @@ wxWin32Renderer::GetTextClientArea(const wxTextCtrl * WXUNUSED(text), return rectText; } +#endif // wxUSE_TEXTCTRL + // ---------------------------------------------------------------------------- // size adjustments // ---------------------------------------------------------------------------- @@ -4446,6 +4518,8 @@ bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control, return false; } +#if wxUSE_SCROLLBAR + // ---------------------------------------------------------------------------- // wxWin32ScrollBarInputHandler // ---------------------------------------------------------------------------- @@ -4628,6 +4702,10 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control, return wxStdScrollBarInputHandler::HandleMouseMove(control, event); } +#endif // wxUSE_SCROLLBAR + +#if wxUSE_CHECKBOX + // ---------------------------------------------------------------------------- // wxWin32CheckboxInputHandler // ---------------------------------------------------------------------------- @@ -4669,6 +4747,10 @@ bool wxWin32CheckboxInputHandler::HandleKey(wxInputConsumer *control, return false; } +#endif // wxUSE_CHECKBOX + +#if wxUSE_TEXTCTRL + // ---------------------------------------------------------------------------- // wxWin32TextCtrlInputHandler // ---------------------------------------------------------------------------- @@ -4707,6 +4789,10 @@ bool wxWin32TextCtrlInputHandler::HandleKey(wxInputConsumer *control, return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed); } +#endif // wxUSE_TEXTCTRL + +#if wxUSE_STATUSBAR + // ---------------------------------------------------------------------------- // wxWin32StatusBarInputHandler // ---------------------------------------------------------------------------- @@ -4800,6 +4886,8 @@ bool wxWin32StatusBarInputHandler::HandleMouseMove(wxInputConsumer *consumer, return wxStdInputHandler::HandleMouseMove(consumer, event); } +#endif // wxUSE_STATUSBAR + // ---------------------------------------------------------------------------- // wxWin32FrameInputHandler // ---------------------------------------------------------------------------- @@ -4883,7 +4971,9 @@ void wxWin32SystemMenuEvtHandler::OnSystemMenu(wxCommandEvent &WXUNUSED(event)) m_wnd->SetAcceleratorTable(wxNullAcceleratorTable); #endif +#if wxUSE_MENUS m_inputHnd->PopupSystemMenu(m_wnd, pt); +#endif // wxUSE_MENUS #if wxUSE_ACCEL m_wnd->SetAcceleratorTable(table); @@ -4942,7 +5032,9 @@ bool wxWin32FrameInputHandler::HandleMouse(wxInputConsumer *consumer, (hit == wxHT_TOPLEVEL_TITLEBAR || hit == wxHT_TOPLEVEL_ICON)) ) { +#if wxUSE_MENUS PopupSystemMenu(tlw, event.GetPosition()); +#endif // wxUSE_MENUS return true; } } @@ -4951,6 +5043,8 @@ bool wxWin32FrameInputHandler::HandleMouse(wxInputConsumer *consumer, return wxStdFrameInputHandler::HandleMouse(consumer, event); } +#if wxUSE_MENUS + void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window, const wxPoint& pos) const { @@ -4985,6 +5079,8 @@ void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window, delete menu; } +#endif // wxUSE_MENUS + bool wxWin32FrameInputHandler::HandleActivation(wxInputConsumer *consumer, bool activated) { diff --git a/src/univ/topluniv.cpp b/src/univ/topluniv.cpp index e14b122ab5..2588071b42 100644 --- a/src/univ/topluniv.cpp +++ b/src/univ/topluniv.cpp @@ -239,12 +239,7 @@ void wxTopLevelWindow::OnNcPaint(wxNcPaintEvent& event) else { // get the window rect - wxRect rect; - wxSize size = GetSize(); - rect.x = - rect.y = 0; - rect.width = size.x; - rect.height = size.y; + wxRect rect(GetSize()); wxWindowDC dc(this); m_renderer->DrawFrameTitleBar(dc, rect, @@ -309,12 +304,14 @@ void wxTopLevelWindow::SetIcons(const wxIconBundle& icons) m_titlebarIcon = wxNullIcon; else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y ) m_titlebarIcon = icon; +#if wxUSE_IMAGE else { wxImage img = bmp1.ConvertToImage(); img.Rescale(size.x, size.y); m_titlebarIcon.CopyFromBitmap(wxBitmap(img)); } +#endif // wxUSE_IMAGE } } } diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index 6297621fd0..a62dbdc55f 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -100,8 +100,10 @@ END_EVENT_TABLE() void wxWindow::Init() { +#if wxUSE_SCROLLBAR m_scrollbarVert = m_scrollbarHorz = (wxScrollBar *)NULL; +#endif // wxUSE_SCROLLBAR m_isCurrent = false; @@ -145,9 +147,11 @@ bool wxWindow::Create(wxWindow *parent, #if wxUSE_TWO_WINDOWS SetInsertIntoMain( true ); #endif +#if wxUSE_SCROLLBAR m_scrollbarVert = new wxScrollBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL); +#endif // wxUSE_SCROLLBAR #if wxUSE_TWO_WINDOWS SetInsertIntoMain( false ); #endif @@ -159,19 +163,23 @@ bool wxWindow::Create(wxWindow *parent, #if wxUSE_TWO_WINDOWS SetInsertIntoMain( true ); #endif +#if wxUSE_SCROLLBAR m_scrollbarHorz = new wxScrollBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL); +#endif // wxUSE_SCROLLBAR #if wxUSE_TWO_WINDOWS SetInsertIntoMain( false ); #endif } +#if wxUSE_SCROLLBAR if (m_scrollbarHorz || m_scrollbarVert) { // position it/them PositionScrollbars(); } +#endif // wxUSE_SCROLLBAR return true; } @@ -225,13 +233,9 @@ void wxWindow::OnNcPaint(wxNcPaintEvent& WXUNUSED(event)) if ( m_renderer ) { // get the window rect - wxRect rect; - wxSize size = GetSize(); - rect.x = - rect.y = 0; - rect.width = size.x; - rect.height = size.y; + wxRect rect(GetSize()); +#if wxUSE_SCROLLBAR // if the scrollbars are outside the border, we must adjust the rect to // exclude them if ( !m_renderer->AreScrollbarsInsideBorder() ) @@ -244,6 +248,7 @@ void wxWindow::OnNcPaint(wxNcPaintEvent& WXUNUSED(event)) if ( scrollbar ) rect.height -= scrollbar->GetSize().y; } +#endif // wxUSE_SCROLLBAR // get the DC and draw the border on it wxWindowDC dc(this); @@ -281,6 +286,7 @@ void wxWindow::OnErase(wxEraseEvent& event) DoDrawBackground(*event.GetDC()); +#if wxUSE_SCROLLBAR // if we have both scrollbars, we also have a square in the corner between // them which we must paint if ( m_scrollbarVert && m_scrollbarHorz ) @@ -300,6 +306,7 @@ void wxWindow::OnErase(wxEraseEvent& event) m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner); } } +#endif // wxUSE_SCROLLBAR } bool wxWindow::DoDrawBackground(wxDC& dc) @@ -533,10 +540,12 @@ void wxWindow::OnSize(wxSizeEvent& event) { event.Skip(); +#if wxUSE_SCROLLBAR if ( m_scrollbarVert || m_scrollbarHorz ) { PositionScrollbars(); } +#endif // wxUSE_SCROLLBAR #if 0 // ndef __WXMSW__ // Refresh the area (strip) previously occupied by the border @@ -697,13 +706,19 @@ void wxWindow::DoGetClientSize(int *width, int *height) const if ( width ) { +#if wxUSE_SCROLLBAR // in any case, take account of the scrollbar if ( m_scrollbarVert ) w -= m_scrollbarVert->GetSize().x; +#endif // wxUSE_SCROLLBAR // if we don't have scrollbar or if it is outside the border (and not // blended into it), take account of the right border as well - if ( !m_scrollbarVert || inside ) + if ( +#if wxUSE_SCROLLBAR + !m_scrollbarVert || +#endif // wxUSE_SCROLLBAR + inside ) w -= rectBorder.width; // and always account for the left border @@ -716,10 +731,16 @@ void wxWindow::DoGetClientSize(int *width, int *height) const if ( height ) { +#if wxUSE_SCROLLBAR if ( m_scrollbarHorz ) h -= m_scrollbarHorz->GetSize().y; +#endif // wxUSE_SCROLLBAR - if ( !m_scrollbarHorz || inside ) + if ( +#if wxUSE_SCROLLBAR + !m_scrollbarHorz || +#endif // wxUSE_SCROLLBAR + inside ) h -= rectBorder.height; *height = h - rectBorder.y; @@ -742,14 +763,26 @@ void wxWindow::DoSetClientSize(int width, int height) // had been called before) bool inside = m_renderer->AreScrollbarsInsideBorder(); wxSize size = GetSize(); +#if wxUSE_SCROLLBAR if ( m_scrollbarVert ) width += size.x - m_scrollbarVert->GetPosition().x; - if ( !m_scrollbarVert || inside ) +#endif // wxUSE_SCROLLBAR + if ( +#if wxUSE_SCROLLBAR + !m_scrollbarVert || +#endif // wxUSE_SCROLLBAR + inside ) width += rectBorder.width; +#if wxUSE_SCROLLBAR if ( m_scrollbarHorz ) height += size.y - m_scrollbarHorz->GetPosition().y; - if ( !m_scrollbarHorz || inside ) +#endif // wxUSE_SCROLLBAR + if ( +#if wxUSE_SCROLLBAR + !m_scrollbarHorz || +#endif // wxUSE_SCROLLBAR + inside ) height += rectBorder.height; wxWindowNative::DoSetClientSize(width, height); @@ -758,6 +791,8 @@ void wxWindow::DoSetClientSize(int width, int height) wxHitTest wxWindow::DoHitTest(wxCoord x, wxCoord y) const { wxHitTest ht = wxWindowNative::DoHitTest(x, y); + +#if wxUSE_SCROLLBAR if ( ht == wxHT_WINDOW_INSIDE ) { if ( m_scrollbarVert && x >= m_scrollbarVert->GetPosition().x ) @@ -772,6 +807,7 @@ wxHitTest wxWindow::DoHitTest(wxCoord x, wxCoord y) const : wxHT_WINDOW_HORZ_SCROLLBAR; } } +#endif // wxUSE_SCROLLBAR return ht; } @@ -784,15 +820,18 @@ wxHitTest wxWindow::DoHitTest(wxCoord x, wxCoord y) const void wxWindow::RefreshScrollbars() { +#if wxUSE_SCROLLBAR if ( m_scrollbarHorz ) m_scrollbarHorz->Refresh(); if ( m_scrollbarVert ) m_scrollbarVert->Refresh(); +#endif // wxUSE_SCROLLBAR } void wxWindow::PositionScrollbars() { +#if wxUSE_SCROLLBAR // do not use GetClientSize/Rect as it relies on the scrollbars being // correctly positioned @@ -838,6 +877,7 @@ void wxWindow::PositionScrollbars() } RefreshScrollbars(); +#endif // wxUSE_SCROLLBAR } void wxWindow::SetScrollbar(int orient, @@ -846,6 +886,7 @@ void wxWindow::SetScrollbar(int orient, int range, bool refresh) { +#if wxUSE_SCROLLBAR wxASSERT_MSG( pageSize <= range, _T("page size can't be greater than range") ); @@ -926,10 +967,18 @@ void wxWindow::SetScrollbar(int orient, (void)GetEventHandler()->ProcessEvent(event); #endif } +#else + wxUnusedVar(orient); + wxUnusedVar(pos); + wxUnusedVar(pageSize); + wxUnusedVar(range); + wxUnusedVar(refresh); +#endif // wxUSE_SCROLLBAR } void wxWindow::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh)) { +#if wxUSE_SCROLLBAR wxScrollBar *scrollbar = GetScrollbar(orient); if (scrollbar) @@ -941,24 +990,43 @@ void wxWindow::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh)) if ( refresh ) Refresh(); #endif +#else + wxUnusedVar(orient); + wxUnusedVar(pos); +#endif // wxUSE_SCROLLBAR } int wxWindow::GetScrollPos(int orient) const { +#if wxUSE_SCROLLBAR wxScrollBar *scrollbar = GetScrollbar(orient); return scrollbar ? scrollbar->GetThumbPosition() : 0; +#else + wxUnusedVar(orient); + return 0; +#endif // wxUSE_SCROLLBAR } int wxWindow::GetScrollThumb(int orient) const { +#if wxUSE_SCROLLBAR wxScrollBar *scrollbar = GetScrollbar(orient); return scrollbar ? scrollbar->GetThumbSize() : 0; +#else + wxUnusedVar(orient); + return 0; +#endif // wxUSE_SCROLLBAR } int wxWindow::GetScrollRange(int orient) const { +#if wxUSE_SCROLLBAR wxScrollBar *scrollbar = GetScrollbar(orient); return scrollbar ? scrollbar->GetRange() : 0; +#else + wxUnusedVar(orient); + return 0; +#endif // wxUSE_SCROLLBAR } void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) @@ -995,8 +1063,10 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) node; node = node->GetNext()) { wxWindow *child = node->GetData(); +#if wxUSE_SCROLLBAR if ( child == m_scrollbarVert || child == m_scrollbarHorz ) continue; +#endif // wxUSE_SCROLLBAR // VS: Scrolling children has non-trivial semantics. If rect=NULL then // it is easy: we scroll all children. Otherwise it gets -- 2.45.2