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
This commit is contained in:
Włodzimierz Skiba
2006-06-08 11:25:30 +00:00
parent b1d8cb4417
commit 9a6384ca1e
22 changed files with 523 additions and 112 deletions

View File

@@ -597,6 +597,13 @@ typedef int wxWindowID;
#define WXUNUSED_IN_WINCE(param) param #define WXUNUSED_IN_WINCE(param) param
#endif #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 */ /* 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 */ /* 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 */ /* when declared, but other compilers then give warnings about unused variable */

View File

@@ -90,6 +90,19 @@ public:
// Does the region contain the rectangle rect? // Does the region contain the rectangle rect?
wxRegionContain Contains(const wxRect& rect) const; 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: protected:
virtual wxObjectRefData *CreateRefData() const; virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;

View File

@@ -30,14 +30,25 @@
#include "wx/renderer.h" #include "wx/renderer.h"
class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxDC; class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxCheckListBox; class WXDLLEXPORT wxCheckListBox;
#if wxUSE_LISTBOX
class WXDLLEXPORT wxListBox; class WXDLLEXPORT wxListBox;
#endif // wxUSE_LISTBOX
#if wxUSE_MENUS
class WXDLLEXPORT wxMenu; class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxMenuGeometryInfo; class WXDLLEXPORT wxMenuGeometryInfo;
#endif // wxUSE_MENUS
class WXDLLEXPORT wxScrollBar; class WXDLLEXPORT wxScrollBar;
#if wxUSE_TEXTCTRL
class WXDLLEXPORT wxTextCtrl; class WXDLLEXPORT wxTextCtrl;
class WXDLLEXPORT wxWindow; #endif
#if wxUSE_GAUGE #if wxUSE_GAUGE
class WXDLLEXPORT wxGauge; class WXDLLEXPORT wxGauge;
#endif // wxUSE_GAUGE #endif // wxUSE_GAUGE
@@ -199,6 +210,7 @@ public:
wxAlignment align = wxALIGN_LEFT, wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1) = 0; int indexAccel = -1) = 0;
#if wxUSE_TOOLBAR
// draw a toolbar button (label may be empty, bitmap may be invalid, if // draw a toolbar button (label may be empty, bitmap may be invalid, if
// both conditions are true this function draws a separator) // both conditions are true this function draws a separator)
virtual void DrawToolBarButton(wxDC& dc, virtual void DrawToolBarButton(wxDC& dc,
@@ -208,6 +220,7 @@ public:
int flags = 0, int flags = 0,
long style = 0, long style = 0,
int tbarStyle = 0) = 0; int tbarStyle = 0) = 0;
#endif // wxUSE_TOOLBAR
// draw a (part of) line in the text control // draw a (part of) line in the text control
virtual void DrawTextLine(wxDC& dc, virtual void DrawTextLine(wxDC& dc,
@@ -229,6 +242,8 @@ public:
int flags = 0, int flags = 0,
int indexAccel = -1) = 0; int indexAccel = -1) = 0;
#if wxUSE_SLIDER
// draw the slider shaft // draw the slider shaft
virtual void DrawSliderShaft(wxDC& dc, virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect, const wxRect& rect,
@@ -255,7 +270,9 @@ public:
int step = 1, int step = 1,
int flags = 0, int flags = 0,
long style = 0) = 0; long style = 0) = 0;
#endif // wxUSE_SLIDER
#if wxUSE_MENUS
// draw a menu bar item // draw a menu bar item
virtual void DrawMenuBarItem(wxDC& dc, virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect, const wxRect& rect,
@@ -279,13 +296,16 @@ public:
virtual void DrawMenuSeparator(wxDC& dc, virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y, wxCoord y,
const wxMenuGeometryInfo& geomInfo) = 0; const wxMenuGeometryInfo& geomInfo) = 0;
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
// draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
// interpreted specially and means "draw the status bar grip" here // interpreted specially and means "draw the status bar grip" here
virtual void DrawStatusField(wxDC& dc, virtual void DrawStatusField(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxString& label, const wxString& label,
int flags = 0, int style = 0) = 0; int flags = 0, int style = 0) = 0;
#endif // wxUSE_STATUSBAR
// draw complete frame/dialog titlebar // draw complete frame/dialog titlebar
virtual void DrawFrameTitleBar(wxDC& dc, virtual void DrawFrameTitleBar(wxDC& dc,
@@ -350,6 +370,8 @@ public:
// the control looks "nice" if it uses the adjusted rectangle // the control looks "nice" if it uses the adjusted rectangle
virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0; virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0;
#if wxUSE_SCROLLBAR
// get the size of a scrollbar arrow // get the size of a scrollbar arrow
virtual wxSize GetScrollbarArrowSize() const = 0; virtual wxSize GetScrollbarArrowSize() const = 0;
@@ -373,6 +395,8 @@ public:
virtual int PixelToScrollbar(const wxScrollBar *scrollbar, virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
wxCoord coord) = 0; wxCoord coord) = 0;
#endif // wxUSE_SCROLLBAR
// get the height of a listbox item from the base font height // get the height of a listbox item from the base font height
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0; virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0;
@@ -388,6 +412,7 @@ public:
// get the margins between/around the toolbar buttons // get the margins between/around the toolbar buttons
virtual wxSize GetToolBarMargin() const = 0; virtual wxSize GetToolBarMargin() const = 0;
#if wxUSE_TEXTCTRL
// convert between text rectangle and client rectangle for text controls: // convert between text rectangle and client rectangle for text controls:
// the former is typicall smaller to leave margins around text // the former is typicall smaller to leave margins around text
virtual wxRect GetTextTotalArea(const wxTextCtrl *text, virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
@@ -397,6 +422,7 @@ public:
virtual wxRect GetTextClientArea(const wxTextCtrl *text, virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rectTotal, const wxRect& rectTotal,
wxCoord *extraSpaceBeyond) const = 0; wxCoord *extraSpaceBeyond) const = 0;
#endif // wxUSE_TEXTCTRL
// get the overhang of a selected tab // get the overhang of a selected tab
virtual wxSize GetTabIndent() const = 0; virtual wxSize GetTabIndent() const = 0;
@@ -404,6 +430,7 @@ public:
// get the padding around the text in a tab // get the padding around the text in a tab
virtual wxSize GetTabPadding() const = 0; virtual wxSize GetTabPadding() const = 0;
#if wxUSE_SLIDER
// get the default size of the slider in lesser dimension (i.e. height of a // get the default size of the slider in lesser dimension (i.e. height of a
// horizontal slider or width of a vertical one) // horizontal slider or width of a vertical one)
virtual wxCoord GetSliderDim() const = 0; virtual wxCoord GetSliderDim() const = 0;
@@ -421,10 +448,12 @@ public:
virtual wxSize GetSliderThumbSize(const wxRect& rect, virtual wxSize GetSliderThumbSize(const wxRect& rect,
int lenThumb, int lenThumb,
wxOrientation orient) const = 0; wxOrientation orient) const = 0;
#endif // wxUSE_SLIDER
// get the size of one progress bar step (in horz and vertical directions) // get the size of one progress bar step (in horz and vertical directions)
virtual wxSize GetProgressBarStep() const = 0; virtual wxSize GetProgressBarStep() const = 0;
#if wxUSE_MENUS
// get the size of rectangle to use in the menubar for the given text rect // get the size of rectangle to use in the menubar for the given text rect
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0; virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0;
@@ -435,10 +464,13 @@ public:
// the returned pointer must be deleted by the caller // the returned pointer must be deleted by the caller
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const = 0; 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 // get the borders around the status bar fields (x and y fields of the
// return value) and also, optionally, the border between the fields // return value) and also, optionally, the border between the fields
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const = 0; virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const = 0;
#endif // wxUSE_STATUSBAR
// get client area rectangle of top level window (i.e. subtract // get client area rectangle of top level window (i.e. subtract
// decorations from given rectangle) // decorations from given rectangle)
@@ -477,6 +509,7 @@ protected:
int selStart, int selEnd, int selStart, int selEnd,
int flags); int flags);
#if wxUSE_SCROLLBAR
// standard scrollbar hit testing: this assumes that it only has 2 arrows // 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. // and a thumb, so the themes which have more complicated scrollbars (e.g.
// BeOS) can't use this method // BeOS) can't use this method
@@ -501,6 +534,8 @@ protected:
int range, int range,
wxCoord *thumbStart, wxCoord *thumbStart,
wxCoord *thumbEnd); wxCoord *thumbEnd);
#endif // wxUSE_SCROLLBAR
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -622,6 +657,7 @@ public:
int indexAccel = -1) int indexAccel = -1)
{ m_renderer->DrawRadioButton(dc, label, bitmap, rect, { m_renderer->DrawRadioButton(dc, label, bitmap, rect,
flags, align, indexAccel); } flags, align, indexAccel); }
#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc, virtual void DrawToolBarButton(wxDC& dc,
const wxString& label, const wxString& label,
const wxBitmap& bitmap, const wxBitmap& bitmap,
@@ -630,6 +666,7 @@ public:
long style = 0, long style = 0,
int tbarStyle = 0) int tbarStyle = 0)
{ m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); } { m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); }
#endif // wxUSE_TOOLBAR
virtual void DrawTextLine(wxDC& dc, virtual void DrawTextLine(wxDC& dc,
const wxString& text, const wxString& text,
const wxRect& rect, const wxRect& rect,
@@ -649,6 +686,8 @@ public:
int accel = -1) int accel = -1)
{ m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); } { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); }
#if wxUSE_SLIDER
virtual void DrawSliderShaft(wxDC& dc, virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect, const wxRect& rect,
int lenThumb, int lenThumb,
@@ -674,7 +713,9 @@ public:
long style = 0) long style = 0)
{ m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient, { m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient,
start, end, start, flags, style); } start, end, start, flags, style); }
#endif // wxUSE_SLIDER
#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc, virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxString& label, const wxString& label,
@@ -695,12 +736,15 @@ public:
wxCoord y, wxCoord y,
const wxMenuGeometryInfo& geomInfo) const wxMenuGeometryInfo& geomInfo)
{ m_renderer->DrawMenuSeparator(dc, y, geomInfo); } { m_renderer->DrawMenuSeparator(dc, y, geomInfo); }
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual void DrawStatusField(wxDC& dc, virtual void DrawStatusField(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxString& label, const wxString& label,
int flags = 0, int style = 0) int flags = 0, int style = 0)
{ m_renderer->DrawStatusField(dc, rect, label, flags, style); } { m_renderer->DrawStatusField(dc, rect, label, flags, style); }
#endif // wxUSE_STATUSBAR
virtual void DrawFrameTitleBar(wxDC& dc, virtual void DrawFrameTitleBar(wxDC& dc,
const wxRect& rect, const wxRect& rect,
@@ -749,6 +793,7 @@ public:
virtual bool AreScrollbarsInsideBorder() const virtual bool AreScrollbarsInsideBorder() const
{ return m_renderer->AreScrollbarsInsideBorder(); } { return m_renderer->AreScrollbarsInsideBorder(); }
#if wxUSE_SCROLLBAR
virtual wxSize GetScrollbarArrowSize() const virtual wxSize GetScrollbarArrowSize() const
{ return m_renderer->GetScrollbarArrowSize(); } { return m_renderer->GetScrollbarArrowSize(); }
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar, virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
@@ -766,6 +811,8 @@ public:
virtual int PixelToScrollbar(const wxScrollBar *scrollbar, virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
wxCoord coord) wxCoord coord)
{ return m_renderer->PixelToScrollbar(scrollbar, coord); } { return m_renderer->PixelToScrollbar(scrollbar, coord); }
#endif // wxUSE_SCROLLBAR
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
{ return m_renderer->GetListboxItemHeight(fontHeight); } { return m_renderer->GetListboxItemHeight(fontHeight); }
virtual wxSize GetCheckBitmapSize() const virtual wxSize GetCheckBitmapSize() const
@@ -780,6 +827,7 @@ public:
virtual wxSize GetToolBarMargin() const virtual wxSize GetToolBarMargin() const
{ return m_renderer->GetToolBarMargin(); } { return m_renderer->GetToolBarMargin(); }
#if wxUSE_TEXTCTRL
virtual wxRect GetTextTotalArea(const wxTextCtrl *text, virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const const wxRect& rect) const
{ return m_renderer->GetTextTotalArea(text, rect); } { return m_renderer->GetTextTotalArea(text, rect); }
@@ -787,14 +835,17 @@ public:
const wxRect& rect, const wxRect& rect,
wxCoord *extraSpaceBeyond) const wxCoord *extraSpaceBeyond) const
{ return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); } { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); }
#endif // wxUSE_TEXTCTRL
virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); } virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); }
virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); } virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); }
#if wxUSE_SLIDER
virtual wxCoord GetSliderDim() const virtual wxCoord GetSliderDim() const
{ return m_renderer->GetSliderDim(); } { return m_renderer->GetSliderDim(); }
virtual wxCoord GetSliderTickLen() const virtual wxCoord GetSliderTickLen() const
{ return m_renderer->GetSliderTickLen(); } { return m_renderer->GetSliderTickLen(); }
virtual wxRect GetSliderShaftRect(const wxRect& rect, virtual wxRect GetSliderShaftRect(const wxRect& rect,
int lenThumb, int lenThumb,
wxOrientation orient, wxOrientation orient,
@@ -804,15 +855,23 @@ public:
int lenThumb, int lenThumb,
wxOrientation orient) const wxOrientation orient) const
{ return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); } { return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); }
#endif // wxUSE_SLIDER
virtual wxSize GetProgressBarStep() const virtual wxSize GetProgressBarStep() const
{ return m_renderer->GetProgressBarStep(); } { return m_renderer->GetProgressBarStep(); }
#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const
{ return m_renderer->GetMenuBarItemSize(sizeText); } { return m_renderer->GetMenuBarItemSize(sizeText); }
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const const wxMenu& menu) const
{ return m_renderer->GetMenuGeometry(win, menu); } { return m_renderer->GetMenuGeometry(win, menu); }
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const
{ return m_renderer->GetStatusBarBorders(borderBetweenFields); } { return m_renderer->GetStatusBarBorders(borderBetweenFields); }
#endif // wxUSE_STATUSBAR
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const
{ return m_renderer->GetFrameClientArea(rect, flags); } { return m_renderer->GetFrameClientArea(rect, flags); }
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const
@@ -892,10 +951,13 @@ public:
wxStretch stretch = wxSTRETCH_NOT); wxStretch stretch = wxSTRETCH_NOT);
private: private:
#if wxUSE_LISTBOX
// common part of DrawItems() and DrawCheckItems() // common part of DrawItems() and DrawCheckItems()
void DoDrawItems(const wxListBox *listbox, void DoDrawItems(const wxListBox *listbox,
size_t itemFirst, size_t itemLast, size_t itemFirst, size_t itemLast,
bool isCheckLbox = false); bool isCheckLbox = false);
#endif // wxUSE_LISTBOX
wxWindow *m_window; wxWindow *m_window;
wxRenderer *m_renderer; wxRenderer *m_renderer;

View File

@@ -14,6 +14,10 @@
// NB: this class is implemented in scrolbar.cpp // NB: this class is implemented in scrolbar.cpp
#include "wx/defs.h"
#if wxUSE_TIMER
#include "wx/timer.h" #include "wx/timer.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -42,4 +46,6 @@ protected:
bool m_skipNext; bool m_skipNext;
}; };
#endif // wxUSE_TIMER
#endif // _WX_UNIV_SCRTIMER_H #endif // _WX_UNIV_SCRTIMER_H

View File

@@ -18,10 +18,17 @@
class WXDLLEXPORT wxControlRenderer; class WXDLLEXPORT wxControlRenderer;
class WXDLLEXPORT wxEventLoop; class WXDLLEXPORT wxEventLoop;
#if wxUSE_MENUS
class WXDLLEXPORT wxMenu; class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxMenuBar; class WXDLLEXPORT wxMenuBar;
#endif // wxUSE_MENUS
class WXDLLEXPORT wxRenderer; class WXDLLEXPORT wxRenderer;
#if wxUSE_SCROLLBAR
class WXDLLEXPORT wxScrollBar; class WXDLLEXPORT wxScrollBar;
#endif // wxUSE_SCROLLBAR
#ifdef __WXX11__ #ifdef __WXX11__
#define wxUSE_TWO_WINDOWS 1 #define wxUSE_TWO_WINDOWS 1
@@ -125,11 +132,13 @@ public:
// set the "highlighted" flag and return true if it changed // set the "highlighted" flag and return true if it changed
virtual bool SetCurrent(bool doit = true); virtual bool SetCurrent(bool doit = true);
#if wxUSE_SCROLLBAR
// get the scrollbar (may be NULL) for the given orientation // get the scrollbar (may be NULL) for the given orientation
wxScrollBar *GetScrollbar(int orient) const wxScrollBar *GetScrollbar(int orient) const
{ {
return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz; return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz;
} }
#endif // wxUSE_SCROLLBAR
// methods used by wxColourScheme to choose the colours for this window // methods used by wxColourScheme to choose the colours for this window
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -256,9 +265,12 @@ public:
#endif // __WXMSW__ #endif // __WXMSW__
private: private:
#if wxUSE_SCROLLBAR
// the window scrollbars // the window scrollbars
wxScrollBar *m_scrollbarHorz, wxScrollBar *m_scrollbarHorz,
*m_scrollbarVert; *m_scrollbarVert;
#endif // wxUSE_SCROLLBAR
#if wxUSE_MENUS #if wxUSE_MENUS
// the current modal event loop for the popup menu we show or NULL // the current modal event loop for the popup menu we show or NULL

View File

@@ -1459,7 +1459,9 @@ bool wxImage::HasOption(const wxString& name) const
// image I/O // 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 wxUSE_STREAMS
if (wxFileExists(filename)) if (wxFileExists(filename))
@@ -1479,7 +1481,9 @@ bool wxImage::LoadFile( const wxString& filename, long type, int index )
#endif // wxUSE_STREAMS #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 wxUSE_STREAMS
if (wxFileExists(filename)) if (wxFileExists(filename))
@@ -1517,7 +1521,8 @@ bool wxImage::SaveFile( const wxString& filename ) const
return false; 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 #if wxUSE_STREAMS
wxCHECK_MSG( Ok(), false, wxT("invalid image") ); wxCHECK_MSG( Ok(), false, wxT("invalid image") );
@@ -1536,7 +1541,8 @@ bool wxImage::SaveFile( const wxString& filename, int type ) const
return false; 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 #if wxUSE_STREAMS
wxCHECK_MSG( Ok(), false, wxT("invalid image") ); wxCHECK_MSG( Ok(), false, wxT("invalid image") );
@@ -1555,7 +1561,7 @@ bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) con
return false; return false;
} }
bool wxImage::CanRead( const wxString &name ) bool wxImage::CanRead( const wxString& WXUNUSED_UNLESS_STREAMS(name) )
{ {
#if wxUSE_STREAMS #if wxUSE_STREAMS
wxFileInputStream stream(name); wxFileInputStream stream(name);
@@ -1565,7 +1571,8 @@ bool wxImage::CanRead( const wxString &name )
#endif #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 #if wxUSE_STREAMS
wxFileInputStream stream(name); wxFileInputStream stream(name);

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: common/init.cpp // Name: src/common/init.cpp
// Purpose: initialisation for the library // Purpose: initialisation for the library
// Author: Vadim Zeitlin // Author: Vadim Zeitlin
// Modified by: // Modified by:

View File

@@ -24,6 +24,11 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_COLOURPICKERCTRL || \
wxUSE_DIRPICKERCTRL || \
wxUSE_FILEPICKERCTRL || \
wxUSE_FONTPICKERCTRL
#include "wx/pickerbase.h" #include "wx/pickerbase.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
@@ -200,3 +205,5 @@ void wxPickerBase::SetInternalMargin(int newmargin)
{ {
m_margin = newmargin; m_margin = newmargin;
} }
#endif // Any picker in use

View File

@@ -462,10 +462,10 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
wxPoint pos = event.GetPosition(); wxPoint pos = event.GetPosition();
// in non-Univ ports the system manages scrollbars for us // in non-Univ ports the system manages scrollbars for us
#ifdef __WXUNIVERSAL__ #if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR
// scrollbar on which the click occurred // scrollbar on which the click occurred
wxWindow *sbar = NULL; wxWindow *sbar = NULL;
#endif // __WXUNIVERSAL__ #endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR
wxWindow *win = (wxWindow *)event.GetEventObject(); wxWindow *win = (wxWindow *)event.GetEventObject();
@@ -498,7 +498,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
} }
break; break;
#ifdef __WXUNIVERSAL__ #if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR
case wxHT_WINDOW_HORZ_SCROLLBAR: case wxHT_WINDOW_HORZ_SCROLLBAR:
sbar = win->GetScrollbar(wxHORIZONTAL); sbar = win->GetScrollbar(wxHORIZONTAL);
break; break;
@@ -506,7 +506,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
case wxHT_WINDOW_VERT_SCROLLBAR: case wxHT_WINDOW_VERT_SCROLLBAR:
sbar = win->GetScrollbar(wxVERTICAL); sbar = win->GetScrollbar(wxVERTICAL);
break; break;
#endif // __WXUNIVERSAL__ #endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR
default: default:
// forgot to update the switch after adding a new hit test code? // forgot to update the switch after adding a new hit test code?
@@ -523,7 +523,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
break; break;
} }
#ifdef __WXUNIVERSAL__ #if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR
if ( sbar ) if ( sbar )
{ {
// translate the event coordinates to the scrollbar ones // translate the event coordinates to the scrollbar ones
@@ -536,7 +536,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
(void)sbar->GetEventHandler()->ProcessEvent(event2); (void)sbar->GetEventHandler()->ProcessEvent(event2);
} }
#endif // __WXUNIVERSAL__ #endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -913,15 +913,18 @@ wxRegisterId (long id)
wxCurrentId = id + 1; wxCurrentId = id + 1;
} }
#if wxUSE_MENUS
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Menu accelerators related functions // Menu accelerators related functions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out) wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out)
{ {
#if wxUSE_MENUS
wxString s = wxMenuItem::GetLabelFromText(in); wxString s = wxMenuItem::GetLabelFromText(in);
#else
wxString str(in);
wxString s = wxStripMenuCodes(str);
#endif // wxUSE_MENUS
if ( out ) if ( out )
{ {
// go smash their buffer if it's not big enough - I love char * params // 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; return out;
} }
#endif // wxUSE_MENUS
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Window search functions // Window search functions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -24,6 +24,8 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_MDI
#include "wx/generic/mdig.h" #include "wx/generic/mdig.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
@@ -812,4 +814,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxGenericMDIParentFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxGenericMDIChildFrame) IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxGenericMDIChildFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxGenericMDIClientWindow) IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxGenericMDIClientWindow)
#endif #endif // wxUSE_GENERIC_MDI_AS_NATIVE
#endif // wxUSE_MDI

View File

@@ -70,6 +70,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );
#if wxUSE_STATBMP
// 1) icon // 1) icon
if (style & wxICON_MASK) if (style & wxICON_MASK)
{ {
@@ -102,11 +103,14 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
else else
icon_text->Add( icon, 0, wxCENTER ); icon_text->Add( icon, 0, wxCENTER );
} }
#endif // wxUSE_STATBMP
#if wxUSE_STATTEXT
// 2) text // 2) text
icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 ); icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 );
topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 ); topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif // wxUSE_STATTEXT
#if wxUSE_STATLINE #if wxUSE_STATLINE
// 3) static line // 3) static line

View File

@@ -17,7 +17,7 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/generic/region.h" #include "wx/region.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
@@ -631,14 +631,17 @@ SOFTWARE.
*/ */
/* Create a new empty region */ /* Create a new empty region */
Region REGION:: Region REGION::XCreateRegion(void)
XCreateRegion(void)
{ {
Region temp; Region temp = new REGION;
if (! (temp = new REGION)) if (!temp)
return (Region) NULL; return (Region) NULL;
if (! (temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX )))) {
temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX ));
if (!temp->rects)
{
free((char *) temp); free((char *) temp);
return (Region) NULL; return (Region) NULL;
} }
@@ -651,10 +654,7 @@ XCreateRegion(void)
return( temp ); return( temp );
} }
bool REGION:: bool REGION::XClipBox(Region r, wxRect *rect)
XClipBox(
Region r,
wxRect *rect)
{ {
rect->x = r->extents.x1; rect->x = r->extents.x1;
rect->y = r->extents.y1; rect->y = r->extents.y1;
@@ -887,9 +887,10 @@ miRegionCopy(
{ {
BOX *prevRects = dstrgn->rects; BOX *prevRects = dstrgn->rects;
if (! (dstrgn->rects = (BOX *) dstrgn->rects = (BOX *)
realloc((char *) dstrgn->rects, realloc((char *) dstrgn->rects,
(unsigned) rgn->numRects * (sizeof(BOX))))) (unsigned) rgn->numRects * (sizeof(BOX)));
if (!dstrgn->rects)
{ {
free(prevRects); free(prevRects);
return; return;
@@ -1156,8 +1157,10 @@ miRegionOp(
*/ */
newReg->size = wxMax(reg1->numRects,reg2->numRects) * 2; newReg->size = wxMax(reg1->numRects,reg2->numRects) * 2;
if (! (newReg->rects = (BoxPtr) newReg->rects = (BoxPtr)malloc((unsigned) (sizeof(BoxRec) * newReg->size));
malloc ((unsigned) (sizeof(BoxRec) * newReg->size)))) {
if (!newReg->rects)
{
newReg->size = 0; newReg->size = 0;
return; return;
} }
@@ -1786,11 +1789,7 @@ miSubtractO (
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
bool REGION:: bool REGION::XSubtractRegion(Region regM, Region regS, register Region regD)
XSubtractRegion(
Region regM,
Region regS,
register Region regD)
{ {
/* check for trivial reject */ /* check for trivial reject */
if ( (!(regM->numRects)) || (!(regS->numRects)) || if ( (!(regM->numRects)) || (!(regS->numRects)) ||
@@ -1814,13 +1813,16 @@ XSubtractRegion(
return true; return true;
} }
bool REGION:: bool REGION::XXorRegion(Region sra, Region srb, Region dr)
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(sra,srb,tra);
(void) XSubtractRegion(srb,sra,trb); (void) XSubtractRegion(srb,sra,trb);
(void) XUnionRegion(tra,trb,dr); (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 * Check to see if the region is empty. Assumes a region is passed
* as a parameter * as a parameter
*/ */
bool REGION:: bool REGION::XEmptyRegion(Region r)
XEmptyRegion(
Region r)
{ {
if( r->numRects == 0 ) return true; if( r->numRects == 0 ) return true;
else return false; else return false;
@@ -1844,8 +1844,7 @@ XEmptyRegion(
/* /*
* Check to see if two regions are equal * Check to see if two regions are equal
*/ */
bool REGION:: bool REGION::XEqualRegion(Region r1, Region r2)
XEqualRegion(Region r1, Region r2)
{ {
int i; int i;
@@ -1864,10 +1863,7 @@ XEqualRegion(Region r1, Region r2)
return true; return true;
} }
bool REGION:: bool REGION::XPointInRegion(Region pRegion, int x, int y)
XPointInRegion(
Region pRegion,
int x, int y)
{ {
int i; int i;
@@ -1883,11 +1879,10 @@ XPointInRegion(
return false; return false;
} }
wxRegionContain REGION:: wxRegionContain REGION::XRectInRegion(register Region region,
XRectInRegion(
register Region region,
int rx, int ry, int rx, int ry,
unsigned int rwidth, unsigned int rheight) unsigned int rwidth,
unsigned int rheight)
{ {
register BoxPtr pbox; register BoxPtr pbox;
register BoxPtr pboxEnd; register BoxPtr pboxEnd;

View File

@@ -127,6 +127,8 @@ void wxRenderer::StandardDrawTextLine(wxDC& dc,
// wxRenderer: scrollbar geometry // wxRenderer: scrollbar geometry
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_SCROLLBAR
/* static */ /* static */
void wxRenderer::StandardScrollBarThumbSize(wxCoord length, void wxRenderer::StandardScrollBarThumbSize(wxCoord length,
int thumbPos, int thumbPos,
@@ -386,6 +388,8 @@ wxHitTest wxRenderer::StandardHitTestScrollbar(const wxScrollBar *scrollbar,
} }
} }
#endif // wxUSE_SCROLLBAR
wxRenderer::~wxRenderer() wxRenderer::~wxRenderer()
{ {
} }
@@ -500,11 +504,13 @@ void wxControlRenderer::DrawBitmap(wxDC &dc,
} }
} }
} }
#if wxUSE_IMAGE
else if ( stretch & wxEXPAND ) else if ( stretch & wxEXPAND )
{ {
// stretch bitmap to fill the entire control // stretch bitmap to fill the entire control
bmp = wxBitmap(wxImage(bmp.ConvertToImage()).Scale(rect.width, rect.height)); bmp = wxBitmap(wxImage(bmp.ConvertToImage()).Scale(rect.width, rect.height));
} }
#endif // wxUSE_IMAGE
else // not stretched, not tiled else // not stretched, not tiled
{ {
if ( alignment & wxALIGN_RIGHT ) if ( alignment & wxALIGN_RIGHT )
@@ -538,6 +544,8 @@ void wxControlRenderer::DrawBitmap(wxDC &dc,
dc.DrawBitmap(bmp, x, y, true /* use mask */); dc.DrawBitmap(bmp, x, y, true /* use mask */);
} }
#if wxUSE_SCROLLBAR
void wxControlRenderer::DrawScrollbar(const wxScrollBar *scrollbar, void wxControlRenderer::DrawScrollbar(const wxScrollBar *scrollbar,
int WXUNUSED(thumbPosOld)) 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) void wxControlRenderer::DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{ {
wxASSERT_MSG( x1 == x2 || y1 == y2, wxASSERT_MSG( x1 == x2 || y1 == y2,

View File

@@ -45,7 +45,9 @@ struct wxScrollArrowCaptureData
m_arrowPressed = wxScrollArrows::Arrow_None; m_arrowPressed = wxScrollArrows::Arrow_None;
m_window = NULL; m_window = NULL;
m_btnCapture = -1; m_btnCapture = -1;
#if wxUSE_TIMER
m_timerScroll = NULL; m_timerScroll = NULL;
#endif // wxUSE_TIMER
} }
~wxScrollArrowCaptureData() ~wxScrollArrowCaptureData()
@@ -53,7 +55,9 @@ struct wxScrollArrowCaptureData
if ( m_window ) if ( m_window )
m_window->ReleaseMouse(); m_window->ReleaseMouse();
#if wxUSE_TIMER
delete m_timerScroll; delete m_timerScroll;
#endif // wxUSE_TIMER
} }
// the arrow being held pressed (may be Arrow_None) // the arrow being held pressed (may be Arrow_None)
@@ -65,14 +69,18 @@ struct wxScrollArrowCaptureData
// the window which has captured the mouse // the window which has captured the mouse
wxWindow *m_window; wxWindow *m_window;
#if wxUSE_TIMER
// the timer for generating the scroll events // the timer for generating the scroll events
wxScrollTimer *m_timerScroll; wxScrollTimer *m_timerScroll;
#endif
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxScrollArrowTimer: a wxScrollTimer which calls OnArrow() // wxScrollArrowTimer: a wxScrollTimer which calls OnArrow()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_TIMER
class wxScrollArrowTimer : public wxScrollTimer class wxScrollArrowTimer : public wxScrollTimer
{ {
public: public:
@@ -95,6 +103,8 @@ protected:
wxScrollArrows::Arrow m_arrow; wxScrollArrows::Arrow m_arrow;
}; };
#endif // wxUSE_TIMER
// ============================================================================ // ============================================================================
// implementation of wxScrollArrows // implementation of wxScrollArrows
// ============================================================================ // ============================================================================
@@ -166,6 +176,7 @@ bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const
arrow = m_control->HitTest(event.GetPosition()); arrow = m_control->HitTest(event.GetPosition());
} }
#if wxUSE_TIMER
if ( m_captureData && m_captureData->m_timerScroll) if ( m_captureData && m_captureData->m_timerScroll)
{ {
// the mouse is captured, we may want to pause scrolling if it goes // 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; return false;
} }
#endif // wxUSE_TIMER
// reset the wxCONTROL_CURRENT flag for the arrows which don't have the // reset the wxCONTROL_CURRENT flag for the arrows which don't have the
// mouse and set it for the one which has // 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 = m_control->GetWindow();
m_captureData->m_window->CaptureMouse(); m_captureData->m_window->CaptureMouse();
#if wxUSE_TIMER
// start scrolling // start scrolling
wxScrollArrowTimer *tmpTimerScroll = wxScrollArrowTimer *tmpTimerScroll =
new wxScrollArrowTimer(m_control, arrow); new wxScrollArrowTimer(m_control, arrow);
#endif // wxUSE_TIMER
// Because in some cases wxScrollArrowTimer can cause // Because in some cases wxScrollArrowTimer can cause
// m_captureData to be destructed we need to test if it // m_captureData to be destructed we need to test if it
// is still valid before using. // is still valid before using.
if (m_captureData) if (m_captureData)
{ {
#if wxUSE_TIMER
m_captureData->m_timerScroll = tmpTimerScroll; m_captureData->m_timerScroll = tmpTimerScroll;
#endif // wxUSE_TIMER
m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, true); m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, true);
} }
else else
{ {
#if wxUSE_TIMER
delete tmpTimerScroll; delete tmpTimerScroll;
#endif // wxUSE_TIMER
} }
} }
//else: mouse already captured, nothing to do //else: mouse already captured, nothing to do

View File

@@ -907,6 +907,8 @@ bool wxStdScrollBarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
#endif // wxUSE_SCROLLBAR #endif // wxUSE_SCROLLBAR
#if wxUSE_TIMER
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxScrollTimer // wxScrollTimer
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -949,3 +951,5 @@ void wxScrollTimer::Notify()
(void)DoNotify(); (void)DoNotify();
} }
} }
#endif // wxUSE_TIMER

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: univ/scrthumb.cpp // Name: src/univ/scrthumb.cpp
// Purpose: wxScrollThumb and related classes // Purpose: wxScrollThumb and related classes
// Author: Vadim Zeitlin // Author: Vadim Zeitlin
// Modified by: // Modified by:
@@ -25,9 +25,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/window.h" #include "wx/window.h"
#include "wx/renderer.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/renderer.h"
#include "wx/univ/scrtimer.h" #include "wx/univ/scrtimer.h"
#include "wx/univ/scrthumb.h" #include "wx/univ/scrthumb.h"
@@ -59,7 +59,9 @@ struct WXDLLEXPORT wxScrollThumbCaptureData
m_window->ReleaseMouse(); m_window->ReleaseMouse();
} }
#if wxUSE_TIMER
delete m_timerScroll; delete m_timerScroll;
#endif // wxUSE_TIMER
} }
// the thumb part being held pressed // the thumb part being held pressed
@@ -83,6 +85,8 @@ struct WXDLLEXPORT wxScrollThumbCaptureData
// wxScrollTimer: the timer used when the arrow is kept pressed // wxScrollTimer: the timer used when the arrow is kept pressed
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_TIMER
class wxScrollThumbTimer : public wxScrollTimer class wxScrollThumbTimer : public wxScrollTimer
{ {
public: public:
@@ -120,6 +124,8 @@ protected:
int m_inc; int m_inc;
}; };
#endif // wxUSE_TIMER
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -192,6 +198,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const
// generate an additional event if we start dragging the thumb // generate an additional event if we start dragging the thumb
m_control->OnThumbDragStart(GetThumbPos(event)); m_control->OnThumbDragStart(GetThumbPos(event));
} }
#if wxUSE_TIMER
else // not the thumb else // not the thumb
{ {
// start timer for auto scrolling when the user presses the mouse // 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 = m_captureData->m_timerScroll =
new wxScrollThumbTimer(m_control, shaftPart); new wxScrollThumbTimer(m_control, shaftPart);
} }
#endif // wxUSE_TIMER
} }
// release mouse if the *same* button went up // release mouse if the *same* button went up
else if ( HasCapture() && (btn == m_captureData->m_btnCapture) ) else if ( HasCapture() && (btn == m_captureData->m_btnCapture) )

View File

@@ -166,6 +166,7 @@ public:
wxAlignment align = wxALIGN_LEFT, wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1); int indexAccel = -1);
#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc, virtual void DrawToolBarButton(wxDC& dc,
const wxString& label, const wxString& label,
const wxBitmap& bitmap, const wxBitmap& bitmap,
@@ -173,6 +174,7 @@ public:
int flags = 0, int flags = 0,
long style = 0, long style = 0,
int tbarStyle = 0); int tbarStyle = 0);
#endif // wxUSE_TOOLBAR
virtual void DrawTextLine(wxDC& dc, virtual void DrawTextLine(wxDC& dc,
const wxString& text, const wxString& text,
@@ -189,6 +191,7 @@ public:
int flags = 0, int flags = 0,
int indexAccel = -1); int indexAccel = -1);
#if wxUSE_SLIDER
virtual void DrawSliderShaft(wxDC& dc, virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect, const wxRect& rect,
int lenThumb, int lenThumb,
@@ -213,7 +216,9 @@ public:
{ {
// we don't have the ticks in GTK version // we don't have the ticks in GTK version
} }
#endif // wxUSE_SLIDER
#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc, virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxString& label, const wxString& label,
@@ -230,11 +235,14 @@ public:
virtual void DrawMenuSeparator(wxDC& dc, virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y, wxCoord y,
const wxMenuGeometryInfo& geomInfo); const wxMenuGeometryInfo& geomInfo);
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual void DrawStatusField(wxDC& dc, virtual void DrawStatusField(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxString& label, const wxString& label,
int flags = 0, int style = 0); int flags = 0, int style = 0);
#endif // wxUSE_STATUSBAR
virtual void DrawFrameTitleBar(wxDC& dc, virtual void DrawFrameTitleBar(wxDC& dc,
const wxRect& rect, const wxRect& rect,
@@ -281,6 +289,7 @@ public:
// geometry and hit testing // geometry and hit testing
virtual wxSize GetScrollbarArrowSize() const virtual wxSize GetScrollbarArrowSize() const
{ return m_sizeScrollbarArrow; } { return m_sizeScrollbarArrow; }
#if wxUSE_SCROLLBAR
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar, virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem, wxScrollBar::Element elem,
int thumbPos = -1) const; int thumbPos = -1) const;
@@ -290,6 +299,8 @@ public:
virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar, virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
int thumbPos = -1); int thumbPos = -1);
virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord); virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
#endif // wxUSE_SCROLLBAR
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
{ return fontHeight + 2; } { return fontHeight + 2; }
virtual wxSize GetCheckBitmapSize() const virtual wxSize GetCheckBitmapSize() const
@@ -304,15 +315,18 @@ public:
virtual wxSize GetToolBarMargin() const virtual wxSize GetToolBarMargin() const
{ return wxSize(6, 6); } { return wxSize(6, 6); }
#if wxUSE_TEXTCTRL
virtual wxRect GetTextTotalArea(const wxTextCtrl *text, virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const; const wxRect& rect) const;
virtual wxRect GetTextClientArea(const wxTextCtrl *text, virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect, const wxRect& rect,
wxCoord *extraSpaceBeyond) const; wxCoord *extraSpaceBeyond) const;
#endif // wxUSE_TEXTCTRL
virtual wxSize GetTabIndent() const { return wxSize(2, 2); } virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
virtual wxSize GetTabPadding() const { return wxSize(6, 6); } virtual wxSize GetTabPadding() const { return wxSize(6, 6); }
#if wxUSE_SLIDER
virtual wxCoord GetSliderDim() const { return 15; } virtual wxCoord GetSliderDim() const { return 15; }
virtual wxCoord GetSliderTickLen() const { return 0; } virtual wxCoord GetSliderTickLen() const { return 0; }
virtual wxRect GetSliderShaftRect(const wxRect& rect, virtual wxRect GetSliderShaftRect(const wxRect& rect,
@@ -322,13 +336,19 @@ public:
virtual wxSize GetSliderThumbSize(const wxRect& rect, virtual wxSize GetSliderThumbSize(const wxRect& rect,
int lenThumb, int lenThumb,
wxOrientation orient) const; wxOrientation orient) const;
#endif // wxUSE_SLIDER
virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); } virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const; virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const; const wxMenu& menu) const;
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const; virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
#endif // wxUSE_STATUSBAR
// helpers for "wxBitmap wxColourScheme::Get()" // helpers for "wxBitmap wxColourScheme::Get()"
void DrawCheckBitmap(wxDC& dc, const wxRect& rect); void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
@@ -400,6 +420,7 @@ protected:
// rect is drawn with DrawAntiShadedRect() and not DrawShadedRect()) // rect is drawn with DrawAntiShadedRect() and not DrawShadedRect())
void DrawAntiRaisedBorder(wxDC& dc, wxRect *rect); void DrawAntiRaisedBorder(wxDC& dc, wxRect *rect);
#if wxUSE_SCROLLBAR
// returns the size of the arrow for the scrollbar (depends on // returns the size of the arrow for the scrollbar (depends on
// orientation) // orientation)
wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar) const wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar) const
@@ -417,6 +438,7 @@ protected:
return size; return size;
} }
#endif // wxUSE_SCROLLBAR
// get the line wrap indicator bitmap // get the line wrap indicator bitmap
wxBitmap GetLineWrapBitmap() const; wxBitmap GetLineWrapBitmap() const;
@@ -515,6 +537,8 @@ protected:
wxGTKRenderer *m_renderer; wxGTKRenderer *m_renderer;
}; };
#if wxUSE_SCROLLBAR
class wxGTKScrollBarInputHandler : public wxStdScrollBarInputHandler class wxGTKScrollBarInputHandler : public wxStdScrollBarInputHandler
{ {
public: public:
@@ -549,6 +573,10 @@ protected:
} }
}; };
#endif // wxUSE_SCROLLBAR
#if wxUSE_CHECKBOX
class wxGTKCheckboxInputHandler : public wxStdCheckboxInputHandler class wxGTKCheckboxInputHandler : public wxStdCheckboxInputHandler
{ {
public: public:
@@ -560,6 +588,10 @@ public:
bool pressed); bool pressed);
}; };
#endif // wxUSE_CHECKBOX
#if wxUSE_TEXTCTRL
class wxGTKTextCtrlInputHandler : public wxStdTextCtrlInputHandler class wxGTKTextCtrlInputHandler : public wxStdTextCtrlInputHandler
{ {
public: public:
@@ -571,6 +603,8 @@ public:
bool pressed); bool pressed);
}; };
#endif // wxUSE_TEXTCTRL
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGTKColourScheme: uses the standard GTK colours // wxGTKColourScheme: uses the standard GTK colours
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -705,14 +739,18 @@ wxInputHandler *wxGTKTheme::GetDefaultInputHandler()
wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control) wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control)
{ {
wxInputHandler *handler; wxInputHandler *handler = NULL;
int n = m_handlerNames.Index(control); int n = m_handlerNames.Index(control);
if ( n == wxNOT_FOUND ) if ( n == wxNOT_FOUND )
{ {
// create a new handler // create a new handler
if ( control == wxINP_HANDLER_SCROLLBAR ) if ( control == wxINP_HANDLER_SCROLLBAR )
{
#if wxUSE_SCROLLBAR
handler = new wxGTKScrollBarInputHandler(m_renderer, handler = new wxGTKScrollBarInputHandler(m_renderer,
GetDefaultInputHandler()); GetDefaultInputHandler());
#endif // wxUSE_SCROLLBAR
}
#if wxUSE_BUTTON #if wxUSE_BUTTON
else if ( control == wxINP_HANDLER_BUTTON ) else if ( control == wxINP_HANDLER_BUTTON )
handler = new wxStdButtonInputHandler(GetDefaultInputHandler()); handler = new wxStdButtonInputHandler(GetDefaultInputHandler());
@@ -755,7 +793,8 @@ wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control)
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR
else if ( control == wxINP_HANDLER_TOPLEVEL ) else if ( control == wxINP_HANDLER_TOPLEVEL )
handler = new wxStdFrameInputHandler(GetDefaultInputHandler()); handler = new wxStdFrameInputHandler(GetDefaultInputHandler());
else
if(!handler)
handler = GetDefaultInputHandler(); handler = GetDefaultInputHandler();
n = m_handlerNames.Add(control); 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 // and for the states for which we don't have any specific colours
if ( !col.Ok() || (flags != 0) ) if ( !col.Ok() || (flags != 0) )
{ {
#if wxUSE_SCROLLBAR
if ( wxDynamicCast(win, wxScrollBar) ) if ( wxDynamicCast(win, wxScrollBar) )
col = Get(SCROLLBAR); col = Get(SCROLLBAR);
else if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() ) else
#endif //wxUSE_SCROLLBAR
if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() )
col = Get(CONTROL_CURRENT); col = Get(CONTROL_CURRENT);
else if ( flags & wxCONTROL_PRESSED ) else if ( flags & wxCONTROL_PRESSED )
col = Get(CONTROL_PRESSED); col = Get(CONTROL_PRESSED);
@@ -841,6 +883,14 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) const
case GAUGE: return Get(CONTROL_CURRENT); 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: case MAX:
default: default:
wxFAIL_MSG(_T("invalid standard colour")); wxFAIL_MSG(_T("invalid standard colour"));
@@ -1679,6 +1729,7 @@ void wxGTKRenderer::DrawRadioButton(wxDC& dc,
flags, align, indexAccel); flags, align, indexAccel);
} }
#if wxUSE_TOOLBAR
void wxGTKRenderer::DrawToolBarButton(wxDC& dc, void wxGTKRenderer::DrawToolBarButton(wxDC& dc,
const wxString& label, const wxString& label,
const wxBitmap& bitmap, const wxBitmap& bitmap,
@@ -1725,11 +1776,14 @@ void wxGTKRenderer::DrawToolBarButton(wxDC& dc,
} }
} }
} }
#endif // wxUSE_TOOLBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// text control // text control
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_TEXTCTRL
wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text), wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text),
const wxRect& rect) const const wxRect& rect) const
{ {
@@ -1759,6 +1813,8 @@ wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text,
return rectText; return rectText;
} }
#endif // wxUSE_TEXTCTRL
void wxGTKRenderer::DrawTextLine(wxDC& dc, void wxGTKRenderer::DrawTextLine(wxDC& dc,
const wxString& text, const wxString& text,
const wxRect& rect, const wxRect& rect,
@@ -1883,11 +1939,21 @@ void wxGTKRenderer::DrawTab(wxDC& dc,
dcMem.SetFont(dc.GetFont()); dcMem.SetFont(dc.GetFont());
dcMem.SetTextForeground(dc.GetTextForeground()); dcMem.SetTextForeground(dc.GetTextForeground());
dcMem.Clear(); 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.DrawLabel(label, bitmapRotated, rectLabel, wxALIGN_CENTRE, indexAccel);
dcMem.SelectObject(wxNullBitmap); dcMem.SelectObject(wxNullBitmap);
bitmapMem = bitmapMem.GetSubBitmap(rectLabel); 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); dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false);
} }
else else
@@ -1986,6 +2052,8 @@ void wxGTKRenderer::DrawTab(wxDC& dc,
} }
} }
#if wxUSE_SLIDER
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// slider // slider
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -2075,6 +2143,10 @@ void wxGTKRenderer::DrawSliderThumb(wxDC& dc,
DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight); DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
} }
#endif // wxUSE_SLIDER
#if wxUSE_MENUS
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// menu and menubar // menu and menubar
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -2340,6 +2412,10 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win,
return gi; return gi;
} }
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// status bar // status bar
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -2357,6 +2433,8 @@ void wxGTKRenderer::DrawStatusField(wxDC& WXUNUSED(dc),
{ {
} }
#endif // wxUSE_STATUSBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// combobox // combobox
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -2780,6 +2858,7 @@ void wxGTKRenderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect); DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
} }
#if wxUSE_SCROLLBAR
wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar, wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem, wxScrollBar::Element elem,
int thumbPos) const int thumbPos) const
@@ -2822,6 +2901,7 @@ int wxGTKRenderer::PixelToScrollbar(const wxScrollBar *scrollbar,
return StandardPixelToScrollbar(scrollbar, coord, return StandardPixelToScrollbar(scrollbar, coord,
GetScrollbarArrowSize(scrollbar)); GetScrollbarArrowSize(scrollbar));
} }
#endif // wxUSE_SCROLLBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// size adjustments // size adjustments
@@ -2859,6 +2939,7 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
} }
} else } else
#endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN #endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN
#if wxUSE_SCROLLBAR
if ( wxDynamicCast(window, wxScrollBar) ) if ( wxDynamicCast(window, wxScrollBar) )
{ {
// we only set the width of vert scrollbars and height of the // 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; size->x = m_sizeScrollbarArrow.x;
} }
else else
#endif // wxUSE_SCROLLBAR
{ {
// take into account the border width // take into account the border width
wxRect rectBorder = GetBorderDimensions(window->GetBorder()); wxRect rectBorder = GetBorderDimensions(window->GetBorder());
@@ -3294,6 +3376,8 @@ bool wxGTKInputHandler::HandleMouseMove(wxInputConsumer *control,
return true; return true;
} }
#if wxUSE_CHECKBOX
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGTKCheckboxInputHandler // wxGTKCheckboxInputHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -3316,6 +3400,10 @@ bool wxGTKCheckboxInputHandler::HandleKey(wxInputConsumer *control,
return false; return false;
} }
#endif // wxUSE_CHECKBOX
#if wxUSE_TEXTCTRL
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGTKTextCtrlInputHandler // wxGTKTextCtrlInputHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -3409,3 +3497,5 @@ bool wxGTKTextCtrlInputHandler::HandleKey(wxInputConsumer *control,
return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed); return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
} }
#endif // wxUSE_TEXTCTRL

View File

@@ -243,6 +243,7 @@ public:
int flags = 0, int flags = 0,
wxAlignment align = wxALIGN_LEFT, wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1); int indexAccel = -1);
#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc, virtual void DrawToolBarButton(wxDC& dc,
const wxString& label, const wxString& label,
const wxBitmap& bitmap, const wxBitmap& bitmap,
@@ -250,6 +251,7 @@ public:
int flags = 0, int flags = 0,
long style = 0, long style = 0,
int tbarStyle = 0); int tbarStyle = 0);
#endif // wxUSE_TOOLBAR
virtual void DrawTextLine(wxDC& dc, virtual void DrawTextLine(wxDC& dc,
const wxString& text, const wxString& text,
const wxRect& rect, const wxRect& rect,
@@ -265,6 +267,7 @@ public:
int flags = 0, int flags = 0,
int indexAccel = -1); int indexAccel = -1);
#if wxUSE_SLIDER
virtual void DrawSliderShaft(wxDC& dc, virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect, const wxRect& rect,
int lenThumb, int lenThumb,
@@ -286,7 +289,9 @@ public:
int step = 1, int step = 1,
int flags = 0, int flags = 0,
long style = 0); long style = 0);
#endif // wxUSE_SLIDER
#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc, virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxString& label, const wxString& label,
@@ -303,11 +308,14 @@ public:
virtual void DrawMenuSeparator(wxDC& dc, virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y, wxCoord y,
const wxMenuGeometryInfo& geomInfo); const wxMenuGeometryInfo& geomInfo);
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual void DrawStatusField(wxDC& dc, virtual void DrawStatusField(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxString& label, const wxString& label,
int flags = 0, int style = 0); int flags = 0, int style = 0);
#endif // wxUSE_STATUSBAR
// titlebars // titlebars
virtual void DrawFrameTitleBar(wxDC& dc, virtual void DrawFrameTitleBar(wxDC& dc,
@@ -352,6 +360,8 @@ public:
virtual wxSize GetScrollbarArrowSize() const virtual wxSize GetScrollbarArrowSize() const
{ return m_sizeScrollbarArrow; } { return m_sizeScrollbarArrow; }
#if wxUSE_SCROLLBAR
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar, virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem, wxScrollBar::Element elem,
int thumbPos = -1) const; int thumbPos = -1) const;
@@ -361,6 +371,8 @@ public:
virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar, virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
int thumbPos = -1); int thumbPos = -1);
virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord); virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
#endif // wxUSE_SCROLLBAR
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
{ return fontHeight + 2; } { return fontHeight + 2; }
virtual wxSize GetCheckBitmapSize() const virtual wxSize GetCheckBitmapSize() const
@@ -375,15 +387,19 @@ public:
virtual wxSize GetToolBarMargin() const virtual wxSize GetToolBarMargin() const
{ return wxSize(4, 4); } { return wxSize(4, 4); }
#if wxUSE_TEXTCTRL
virtual wxRect GetTextTotalArea(const wxTextCtrl *text, virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const; const wxRect& rect) const;
virtual wxRect GetTextClientArea(const wxTextCtrl *text, virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect, const wxRect& rect,
wxCoord *extraSpaceBeyond) const; wxCoord *extraSpaceBeyond) const;
#endif // wxUSE_TEXTCTRL
virtual wxSize GetTabIndent() const { return wxSize(2, 2); } virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
virtual wxSize GetTabPadding() const { return wxSize(6, 5); } virtual wxSize GetTabPadding() const { return wxSize(6, 5); }
#if wxUSE_SLIDER
virtual wxCoord GetSliderDim() const { return SLIDER_THUMB_LENGTH + 2*BORDER_THICKNESS; } virtual wxCoord GetSliderDim() const { return SLIDER_THUMB_LENGTH + 2*BORDER_THICKNESS; }
virtual wxCoord GetSliderTickLen() const { return SLIDER_TICK_LENGTH; } virtual wxCoord GetSliderTickLen() const { return SLIDER_TICK_LENGTH; }
virtual wxRect GetSliderShaftRect(const wxRect& rect, virtual wxRect GetSliderShaftRect(const wxRect& rect,
@@ -393,13 +409,19 @@ public:
virtual wxSize GetSliderThumbSize(const wxRect& rect, virtual wxSize GetSliderThumbSize(const wxRect& rect,
int lenThumb, int lenThumb,
wxOrientation orient) const; wxOrientation orient) const;
#endif // wxUSE_SLIDER
virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); } virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const; virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const; const wxMenu& menu) const;
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const; virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
#endif // wxUSE_STATUSBAR
protected: protected:
// helper of DrawLabel() and DrawCheckOrRadioButton() // helper of DrawLabel() and DrawCheckOrRadioButton()
@@ -543,6 +565,7 @@ protected:
wxWin32Renderer *m_renderer; wxWin32Renderer *m_renderer;
}; };
#if wxUSE_SCROLLBAR
class wxWin32ScrollBarInputHandler : public wxStdScrollBarInputHandler class wxWin32ScrollBarInputHandler : public wxStdScrollBarInputHandler
{ {
public: public:
@@ -574,7 +597,9 @@ protected:
// we remember the interval of the timer to be able to restart it // we remember the interval of the timer to be able to restart it
int m_interval; int m_interval;
}; };
#endif // wxUSE_SCROLLBAR
#if wxUSE_CHECKBOX
class wxWin32CheckboxInputHandler : public wxStdCheckboxInputHandler class wxWin32CheckboxInputHandler : public wxStdCheckboxInputHandler
{ {
public: public:
@@ -585,7 +610,9 @@ public:
const wxKeyEvent& event, const wxKeyEvent& event,
bool pressed); bool pressed);
}; };
#endif // wxUSE_CHECKBOX
#if wxUSE_TEXTCTRL
class wxWin32TextCtrlInputHandler : public wxStdTextCtrlInputHandler class wxWin32TextCtrlInputHandler : public wxStdTextCtrlInputHandler
{ {
public: public:
@@ -596,6 +623,7 @@ public:
const wxKeyEvent& event, const wxKeyEvent& event,
bool pressed); bool pressed);
}; };
#endif // wxUSE_TEXTCTRL
class wxWin32StatusBarInputHandler : public wxStdInputHandler class wxWin32StatusBarInputHandler : public wxStdInputHandler
{ {
@@ -633,7 +661,9 @@ public:
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated); virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
#if wxUSE_MENUS
void PopupSystemMenu(wxTopLevelWindow *window, const wxPoint& pos) const; void PopupSystemMenu(wxTopLevelWindow *window, const wxPoint& pos) const;
#endif // wxUSE_MENUS
private: private:
// was the mouse over the grip last time we checked? // was the mouse over the grip last time we checked?
@@ -1297,14 +1327,18 @@ wxInputHandler *wxWin32Theme::GetDefaultInputHandler()
wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control) wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control)
{ {
wxInputHandler *handler; wxInputHandler *handler = NULL;
int n = m_handlerNames.Index(control); int n = m_handlerNames.Index(control);
if ( n == wxNOT_FOUND ) if ( n == wxNOT_FOUND )
{ {
// create a new handler // create a new handler
if ( control == wxINP_HANDLER_SCROLLBAR ) if ( control == wxINP_HANDLER_SCROLLBAR )
{
#if wxUSE_SCROLLBAR
handler = new wxWin32ScrollBarInputHandler(m_renderer, handler = new wxWin32ScrollBarInputHandler(m_renderer,
GetDefaultInputHandler()); GetDefaultInputHandler());
#endif // wxUSE_SCROLLBAR
}
#if wxUSE_BUTTON #if wxUSE_BUTTON
else if ( control == wxINP_HANDLER_BUTTON ) else if ( control == wxINP_HANDLER_BUTTON )
handler = new wxStdButtonInputHandler(GetDefaultInputHandler()); handler = new wxStdButtonInputHandler(GetDefaultInputHandler());
@@ -1351,7 +1385,8 @@ wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control)
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR
else if ( control == wxINP_HANDLER_TOPLEVEL ) else if ( control == wxINP_HANDLER_TOPLEVEL )
handler = new wxWin32FrameInputHandler(GetDefaultInputHandler()); handler = new wxWin32FrameInputHandler(GetDefaultInputHandler());
else
if(!handler)
handler = GetDefaultInputHandler(); handler = GetDefaultInputHandler();
n = m_handlerNames.Add(control); n = m_handlerNames.Add(control);
@@ -1389,10 +1424,14 @@ wxColour wxWin32ColourScheme::GetBackground(wxWindow *win) const
if ( !win->ShouldInheritColours() ) if ( !win->ShouldInheritColours() )
{ {
#if wxUSE_TEXTCTRL
wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl); wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
#endif // wxUSE_TEXTCTRL
#if wxUSE_LISTBOX #if wxUSE_LISTBOX
wxListBox* listBox = wxDynamicCast(win, wxListBox); wxListBox* listBox = wxDynamicCast(win, wxListBox);
#endif #endif // wxUSE_LISTBOX
#if wxUSE_TEXTCTRL
if ( text if ( text
#if wxUSE_LISTBOX #if wxUSE_LISTBOX
|| listBox || listBox
@@ -1410,6 +1449,7 @@ wxColour wxWin32ColourScheme::GetBackground(wxWindow *win) const
} }
} }
} }
#endif // wxUSE_TEXTCTRL
if (!col.Ok()) if (!col.Ok())
col = Get(CONTROL); // Most controls should be this colour, not WINDOW 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 // and for the states for which we don't have any specific colours
if ( !col.Ok() || (flags & wxCONTROL_PRESSED) != 0 ) if ( !col.Ok() || (flags & wxCONTROL_PRESSED) != 0 )
{ {
#if wxUSE_SCROLLBAR
if ( wxDynamicCast(win, wxScrollBar) ) if ( wxDynamicCast(win, wxScrollBar) )
col = Get(flags & wxCONTROL_PRESSED ? SCROLLBAR_PRESSED col = Get(flags & wxCONTROL_PRESSED ? SCROLLBAR_PRESSED
: SCROLLBAR); : SCROLLBAR);
else else
#endif // wxUSE_SCROLLBAR
col = Get(CONTROL); col = Get(CONTROL);
} }
} }
@@ -2475,6 +2517,7 @@ void wxWin32Renderer::DrawCheckButton(wxDC& dc,
0); // no focus rect offset for checkboxes 0); // no focus rect offset for checkboxes
} }
#if wxUSE_TOOLBAR
void wxWin32Renderer::DrawToolBarButton(wxDC& dc, void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
const wxString& label, const wxString& label,
const wxBitmap& bitmap, const wxBitmap& bitmap,
@@ -2536,6 +2579,7 @@ void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
} }
// don't draw wxTOOL_STYLE_CONTROL // don't draw wxTOOL_STYLE_CONTROL
} }
#endif // wxUSE_TOOLBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// text control // text control
@@ -2627,12 +2671,20 @@ void wxWin32Renderer::DrawTab(wxDC& dc,
dcMem.SetFont(dc.GetFont()); dcMem.SetFont(dc.GetFont());
dcMem.SetTextForeground(dc.GetTextForeground()); dcMem.SetTextForeground(dc.GetTextForeground());
dcMem.Clear(); 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, DrawButtonLabel(dcMem, label, bitmapRotated, rectLabel,
flags, wxALIGN_CENTRE, indexAccel); flags, wxALIGN_CENTRE, indexAccel);
dcMem.SelectObject(wxNullBitmap); dcMem.SelectObject(wxNullBitmap);
bitmapMem = bitmapMem.GetSubBitmap(rectLabel); bitmapMem = bitmapMem.GetSubBitmap(rectLabel);
#if wxUSE_IMAGE
bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT)); bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT));
#endif // wxUSE_IMAGE
dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false); dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false);
} }
else else
@@ -2737,6 +2789,8 @@ void wxWin32Renderer::DrawTab(wxDC& dc,
#undef REVERSE_FOR_VERTICAL #undef REVERSE_FOR_VERTICAL
} }
#if wxUSE_SLIDER
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// slider // slider
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -3086,6 +3140,10 @@ void wxWin32Renderer::DrawSliderTicks(wxDC& dc,
} }
} }
#endif // wxUSE_SLIDER
#if wxUSE_MENUS
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// menu and menubar // menu and menubar
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -3348,6 +3406,10 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
return gi; return gi;
} }
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// status bar // status bar
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -3440,6 +3502,8 @@ void wxWin32Renderer::DrawStatusField(wxDC& dc,
DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL); DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
} }
#endif // wxUSE_STATUSBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// combobox // combobox
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -3600,6 +3664,8 @@ void wxWin32Renderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect); DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
} }
#if wxUSE_SCROLLBAR
wxRect wxWin32Renderer::GetScrollbarRect(const wxScrollBar *scrollbar, wxRect wxWin32Renderer::GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem, wxScrollBar::Element elem,
int thumbPos) const int thumbPos) const
@@ -3631,6 +3697,8 @@ int wxWin32Renderer::PixelToScrollbar(const wxScrollBar *scrollbar,
return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow); return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow);
} }
#endif // wxUSE_SCROLLBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// top level windows // top level windows
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4290,6 +4358,8 @@ wxBitmap wxWin32ArtProvider::CreateBitmap(const wxArtID& id,
} }
#if wxUSE_TEXTCTRL
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// text control geometry // text control geometry
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4334,6 +4404,8 @@ wxWin32Renderer::GetTextClientArea(const wxTextCtrl * WXUNUSED(text),
return rectText; return rectText;
} }
#endif // wxUSE_TEXTCTRL
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// size adjustments // size adjustments
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4446,6 +4518,8 @@ bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control,
return false; return false;
} }
#if wxUSE_SCROLLBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin32ScrollBarInputHandler // wxWin32ScrollBarInputHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4628,6 +4702,10 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control,
return wxStdScrollBarInputHandler::HandleMouseMove(control, event); return wxStdScrollBarInputHandler::HandleMouseMove(control, event);
} }
#endif // wxUSE_SCROLLBAR
#if wxUSE_CHECKBOX
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin32CheckboxInputHandler // wxWin32CheckboxInputHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4669,6 +4747,10 @@ bool wxWin32CheckboxInputHandler::HandleKey(wxInputConsumer *control,
return false; return false;
} }
#endif // wxUSE_CHECKBOX
#if wxUSE_TEXTCTRL
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin32TextCtrlInputHandler // wxWin32TextCtrlInputHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4707,6 +4789,10 @@ bool wxWin32TextCtrlInputHandler::HandleKey(wxInputConsumer *control,
return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed); return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
} }
#endif // wxUSE_TEXTCTRL
#if wxUSE_STATUSBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin32StatusBarInputHandler // wxWin32StatusBarInputHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4800,6 +4886,8 @@ bool wxWin32StatusBarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
return wxStdInputHandler::HandleMouseMove(consumer, event); return wxStdInputHandler::HandleMouseMove(consumer, event);
} }
#endif // wxUSE_STATUSBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin32FrameInputHandler // wxWin32FrameInputHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -4883,7 +4971,9 @@ void wxWin32SystemMenuEvtHandler::OnSystemMenu(wxCommandEvent &WXUNUSED(event))
m_wnd->SetAcceleratorTable(wxNullAcceleratorTable); m_wnd->SetAcceleratorTable(wxNullAcceleratorTable);
#endif #endif
#if wxUSE_MENUS
m_inputHnd->PopupSystemMenu(m_wnd, pt); m_inputHnd->PopupSystemMenu(m_wnd, pt);
#endif // wxUSE_MENUS
#if wxUSE_ACCEL #if wxUSE_ACCEL
m_wnd->SetAcceleratorTable(table); m_wnd->SetAcceleratorTable(table);
@@ -4942,7 +5032,9 @@ bool wxWin32FrameInputHandler::HandleMouse(wxInputConsumer *consumer,
(hit == wxHT_TOPLEVEL_TITLEBAR || (hit == wxHT_TOPLEVEL_TITLEBAR ||
hit == wxHT_TOPLEVEL_ICON)) ) hit == wxHT_TOPLEVEL_ICON)) )
{ {
#if wxUSE_MENUS
PopupSystemMenu(tlw, event.GetPosition()); PopupSystemMenu(tlw, event.GetPosition());
#endif // wxUSE_MENUS
return true; return true;
} }
} }
@@ -4951,6 +5043,8 @@ bool wxWin32FrameInputHandler::HandleMouse(wxInputConsumer *consumer,
return wxStdFrameInputHandler::HandleMouse(consumer, event); return wxStdFrameInputHandler::HandleMouse(consumer, event);
} }
#if wxUSE_MENUS
void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window, void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window,
const wxPoint& pos) const const wxPoint& pos) const
{ {
@@ -4985,6 +5079,8 @@ void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window,
delete menu; delete menu;
} }
#endif // wxUSE_MENUS
bool wxWin32FrameInputHandler::HandleActivation(wxInputConsumer *consumer, bool wxWin32FrameInputHandler::HandleActivation(wxInputConsumer *consumer,
bool activated) bool activated)
{ {

View File

@@ -239,12 +239,7 @@ void wxTopLevelWindow::OnNcPaint(wxNcPaintEvent& event)
else else
{ {
// get the window rect // get the window rect
wxRect rect; wxRect rect(GetSize());
wxSize size = GetSize();
rect.x =
rect.y = 0;
rect.width = size.x;
rect.height = size.y;
wxWindowDC dc(this); wxWindowDC dc(this);
m_renderer->DrawFrameTitleBar(dc, rect, m_renderer->DrawFrameTitleBar(dc, rect,
@@ -309,12 +304,14 @@ void wxTopLevelWindow::SetIcons(const wxIconBundle& icons)
m_titlebarIcon = wxNullIcon; m_titlebarIcon = wxNullIcon;
else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y ) else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y )
m_titlebarIcon = icon; m_titlebarIcon = icon;
#if wxUSE_IMAGE
else else
{ {
wxImage img = bmp1.ConvertToImage(); wxImage img = bmp1.ConvertToImage();
img.Rescale(size.x, size.y); img.Rescale(size.x, size.y);
m_titlebarIcon.CopyFromBitmap(wxBitmap(img)); m_titlebarIcon.CopyFromBitmap(wxBitmap(img));
} }
#endif // wxUSE_IMAGE
} }
} }
} }

View File

@@ -100,8 +100,10 @@ END_EVENT_TABLE()
void wxWindow::Init() void wxWindow::Init()
{ {
#if wxUSE_SCROLLBAR
m_scrollbarVert = m_scrollbarVert =
m_scrollbarHorz = (wxScrollBar *)NULL; m_scrollbarHorz = (wxScrollBar *)NULL;
#endif // wxUSE_SCROLLBAR
m_isCurrent = false; m_isCurrent = false;
@@ -145,9 +147,11 @@ bool wxWindow::Create(wxWindow *parent,
#if wxUSE_TWO_WINDOWS #if wxUSE_TWO_WINDOWS
SetInsertIntoMain( true ); SetInsertIntoMain( true );
#endif #endif
#if wxUSE_SCROLLBAR
m_scrollbarVert = new wxScrollBar(this, wxID_ANY, m_scrollbarVert = new wxScrollBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxSB_VERTICAL); wxSB_VERTICAL);
#endif // wxUSE_SCROLLBAR
#if wxUSE_TWO_WINDOWS #if wxUSE_TWO_WINDOWS
SetInsertIntoMain( false ); SetInsertIntoMain( false );
#endif #endif
@@ -159,19 +163,23 @@ bool wxWindow::Create(wxWindow *parent,
#if wxUSE_TWO_WINDOWS #if wxUSE_TWO_WINDOWS
SetInsertIntoMain( true ); SetInsertIntoMain( true );
#endif #endif
#if wxUSE_SCROLLBAR
m_scrollbarHorz = new wxScrollBar(this, wxID_ANY, m_scrollbarHorz = new wxScrollBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxSB_HORIZONTAL); wxSB_HORIZONTAL);
#endif // wxUSE_SCROLLBAR
#if wxUSE_TWO_WINDOWS #if wxUSE_TWO_WINDOWS
SetInsertIntoMain( false ); SetInsertIntoMain( false );
#endif #endif
} }
#if wxUSE_SCROLLBAR
if (m_scrollbarHorz || m_scrollbarVert) if (m_scrollbarHorz || m_scrollbarVert)
{ {
// position it/them // position it/them
PositionScrollbars(); PositionScrollbars();
} }
#endif // wxUSE_SCROLLBAR
return true; return true;
} }
@@ -225,13 +233,9 @@ void wxWindow::OnNcPaint(wxNcPaintEvent& WXUNUSED(event))
if ( m_renderer ) if ( m_renderer )
{ {
// get the window rect // get the window rect
wxRect rect; wxRect rect(GetSize());
wxSize size = GetSize();
rect.x =
rect.y = 0;
rect.width = size.x;
rect.height = size.y;
#if wxUSE_SCROLLBAR
// if the scrollbars are outside the border, we must adjust the rect to // if the scrollbars are outside the border, we must adjust the rect to
// exclude them // exclude them
if ( !m_renderer->AreScrollbarsInsideBorder() ) if ( !m_renderer->AreScrollbarsInsideBorder() )
@@ -244,6 +248,7 @@ void wxWindow::OnNcPaint(wxNcPaintEvent& WXUNUSED(event))
if ( scrollbar ) if ( scrollbar )
rect.height -= scrollbar->GetSize().y; rect.height -= scrollbar->GetSize().y;
} }
#endif // wxUSE_SCROLLBAR
// get the DC and draw the border on it // get the DC and draw the border on it
wxWindowDC dc(this); wxWindowDC dc(this);
@@ -281,6 +286,7 @@ void wxWindow::OnErase(wxEraseEvent& event)
DoDrawBackground(*event.GetDC()); DoDrawBackground(*event.GetDC());
#if wxUSE_SCROLLBAR
// if we have both scrollbars, we also have a square in the corner between // if we have both scrollbars, we also have a square in the corner between
// them which we must paint // them which we must paint
if ( m_scrollbarVert && m_scrollbarHorz ) if ( m_scrollbarVert && m_scrollbarHorz )
@@ -300,6 +306,7 @@ void wxWindow::OnErase(wxEraseEvent& event)
m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner); m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner);
} }
} }
#endif // wxUSE_SCROLLBAR
} }
bool wxWindow::DoDrawBackground(wxDC& dc) bool wxWindow::DoDrawBackground(wxDC& dc)
@@ -533,10 +540,12 @@ void wxWindow::OnSize(wxSizeEvent& event)
{ {
event.Skip(); event.Skip();
#if wxUSE_SCROLLBAR
if ( m_scrollbarVert || m_scrollbarHorz ) if ( m_scrollbarVert || m_scrollbarHorz )
{ {
PositionScrollbars(); PositionScrollbars();
} }
#endif // wxUSE_SCROLLBAR
#if 0 // ndef __WXMSW__ #if 0 // ndef __WXMSW__
// Refresh the area (strip) previously occupied by the border // Refresh the area (strip) previously occupied by the border
@@ -697,13 +706,19 @@ void wxWindow::DoGetClientSize(int *width, int *height) const
if ( width ) if ( width )
{ {
#if wxUSE_SCROLLBAR
// in any case, take account of the scrollbar // in any case, take account of the scrollbar
if ( m_scrollbarVert ) if ( m_scrollbarVert )
w -= m_scrollbarVert->GetSize().x; w -= m_scrollbarVert->GetSize().x;
#endif // wxUSE_SCROLLBAR
// if we don't have scrollbar or if it is outside the border (and not // 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 // 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; w -= rectBorder.width;
// and always account for the left border // and always account for the left border
@@ -716,10 +731,16 @@ void wxWindow::DoGetClientSize(int *width, int *height) const
if ( height ) if ( height )
{ {
#if wxUSE_SCROLLBAR
if ( m_scrollbarHorz ) if ( m_scrollbarHorz )
h -= m_scrollbarHorz->GetSize().y; 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; h -= rectBorder.height;
*height = h - rectBorder.y; *height = h - rectBorder.y;
@@ -742,14 +763,26 @@ void wxWindow::DoSetClientSize(int width, int height)
// had been called before) // had been called before)
bool inside = m_renderer->AreScrollbarsInsideBorder(); bool inside = m_renderer->AreScrollbarsInsideBorder();
wxSize size = GetSize(); wxSize size = GetSize();
#if wxUSE_SCROLLBAR
if ( m_scrollbarVert ) if ( m_scrollbarVert )
width += size.x - m_scrollbarVert->GetPosition().x; 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; width += rectBorder.width;
#if wxUSE_SCROLLBAR
if ( m_scrollbarHorz ) if ( m_scrollbarHorz )
height += size.y - m_scrollbarHorz->GetPosition().y; 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; height += rectBorder.height;
wxWindowNative::DoSetClientSize(width, 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 wxWindow::DoHitTest(wxCoord x, wxCoord y) const
{ {
wxHitTest ht = wxWindowNative::DoHitTest(x, y); wxHitTest ht = wxWindowNative::DoHitTest(x, y);
#if wxUSE_SCROLLBAR
if ( ht == wxHT_WINDOW_INSIDE ) if ( ht == wxHT_WINDOW_INSIDE )
{ {
if ( m_scrollbarVert && x >= m_scrollbarVert->GetPosition().x ) if ( m_scrollbarVert && x >= m_scrollbarVert->GetPosition().x )
@@ -772,6 +807,7 @@ wxHitTest wxWindow::DoHitTest(wxCoord x, wxCoord y) const
: wxHT_WINDOW_HORZ_SCROLLBAR; : wxHT_WINDOW_HORZ_SCROLLBAR;
} }
} }
#endif // wxUSE_SCROLLBAR
return ht; return ht;
} }
@@ -784,15 +820,18 @@ wxHitTest wxWindow::DoHitTest(wxCoord x, wxCoord y) const
void wxWindow::RefreshScrollbars() void wxWindow::RefreshScrollbars()
{ {
#if wxUSE_SCROLLBAR
if ( m_scrollbarHorz ) if ( m_scrollbarHorz )
m_scrollbarHorz->Refresh(); m_scrollbarHorz->Refresh();
if ( m_scrollbarVert ) if ( m_scrollbarVert )
m_scrollbarVert->Refresh(); m_scrollbarVert->Refresh();
#endif // wxUSE_SCROLLBAR
} }
void wxWindow::PositionScrollbars() void wxWindow::PositionScrollbars()
{ {
#if wxUSE_SCROLLBAR
// do not use GetClientSize/Rect as it relies on the scrollbars being // do not use GetClientSize/Rect as it relies on the scrollbars being
// correctly positioned // correctly positioned
@@ -838,6 +877,7 @@ void wxWindow::PositionScrollbars()
} }
RefreshScrollbars(); RefreshScrollbars();
#endif // wxUSE_SCROLLBAR
} }
void wxWindow::SetScrollbar(int orient, void wxWindow::SetScrollbar(int orient,
@@ -846,6 +886,7 @@ void wxWindow::SetScrollbar(int orient,
int range, int range,
bool refresh) bool refresh)
{ {
#if wxUSE_SCROLLBAR
wxASSERT_MSG( pageSize <= range, wxASSERT_MSG( pageSize <= range,
_T("page size can't be greater than range") ); _T("page size can't be greater than range") );
@@ -926,10 +967,18 @@ void wxWindow::SetScrollbar(int orient,
(void)GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(event);
#endif #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)) void wxWindow::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
{ {
#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient); wxScrollBar *scrollbar = GetScrollbar(orient);
if (scrollbar) if (scrollbar)
@@ -941,24 +990,43 @@ void wxWindow::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
if ( refresh ) if ( refresh )
Refresh(); Refresh();
#endif #endif
#else
wxUnusedVar(orient);
wxUnusedVar(pos);
#endif // wxUSE_SCROLLBAR
} }
int wxWindow::GetScrollPos(int orient) const int wxWindow::GetScrollPos(int orient) const
{ {
#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient); wxScrollBar *scrollbar = GetScrollbar(orient);
return scrollbar ? scrollbar->GetThumbPosition() : 0; return scrollbar ? scrollbar->GetThumbPosition() : 0;
#else
wxUnusedVar(orient);
return 0;
#endif // wxUSE_SCROLLBAR
} }
int wxWindow::GetScrollThumb(int orient) const int wxWindow::GetScrollThumb(int orient) const
{ {
#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient); wxScrollBar *scrollbar = GetScrollbar(orient);
return scrollbar ? scrollbar->GetThumbSize() : 0; return scrollbar ? scrollbar->GetThumbSize() : 0;
#else
wxUnusedVar(orient);
return 0;
#endif // wxUSE_SCROLLBAR
} }
int wxWindow::GetScrollRange(int orient) const int wxWindow::GetScrollRange(int orient) const
{ {
#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient); wxScrollBar *scrollbar = GetScrollbar(orient);
return scrollbar ? scrollbar->GetRange() : 0; return scrollbar ? scrollbar->GetRange() : 0;
#else
wxUnusedVar(orient);
return 0;
#endif // wxUSE_SCROLLBAR
} }
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) 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()) node; node = node->GetNext())
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
#if wxUSE_SCROLLBAR
if ( child == m_scrollbarVert || child == m_scrollbarHorz ) if ( child == m_scrollbarVert || child == m_scrollbarHorz )
continue; continue;
#endif // wxUSE_SCROLLBAR
// VS: Scrolling children has non-trivial semantics. If rect=NULL then // VS: Scrolling children has non-trivial semantics. If rect=NULL then
// it is easy: we scroll all children. Otherwise it gets // it is easy: we scroll all children. Otherwise it gets