#define WXUNUSED_IN_WINCE(param) param
#endif
+/* unused parameters in non stream builds */
+#if wxUSE_STREAMS
+ #define WXUNUSED_UNLESS_STREAMS(param) param
+#else
+ #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param)
+#endif
+
/* some compilers give warning about a possibly unused variable if it is */
/* initialized in both branches of if/else and shut up if it is initialized */
/* when declared, but other compilers then give warnings about unused variable */
// Does the region contain the rectangle rect?
wxRegionContain Contains(const wxRect& rect) const;
+ // Use the non-transparent pixels of a wxBitmap for the region to combine
+ // with this region. First version takes transparency from bitmap's mask,
+ // second lets the user specify the colour to be treated as transparent
+ // along with an optional tolerance value.
+ // NOTE: implemented in common/rgncmn.cpp
+ bool Union(const wxBitmap& bmp);
+ bool Union(const wxBitmap& bmp,
+ const wxColour& transColour, int tolerance = 0);
+
+ // Convert the region to a B&W bitmap with the white pixels being inside
+ // the region.
+ wxBitmap ConvertToBitmap() const;
+
protected:
virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
#include "wx/renderer.h"
+class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxCheckListBox;
-class WXDLLEXPORT wxListBox;
-class WXDLLEXPORT wxMenu;
-class WXDLLEXPORT wxMenuGeometryInfo;
+
+#if wxUSE_LISTBOX
+ class WXDLLEXPORT wxListBox;
+#endif // wxUSE_LISTBOX
+
+#if wxUSE_MENUS
+ class WXDLLEXPORT wxMenu;
+ class WXDLLEXPORT wxMenuGeometryInfo;
+#endif // wxUSE_MENUS
+
class WXDLLEXPORT wxScrollBar;
-class WXDLLEXPORT wxTextCtrl;
-class WXDLLEXPORT wxWindow;
+
+#if wxUSE_TEXTCTRL
+ class WXDLLEXPORT wxTextCtrl;
+#endif
+
#if wxUSE_GAUGE
-class WXDLLEXPORT wxGauge;
+ class WXDLLEXPORT wxGauge;
#endif // wxUSE_GAUGE
#include "wx/string.h"
wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1) = 0;
+#if wxUSE_TOOLBAR
// draw a toolbar button (label may be empty, bitmap may be invalid, if
// both conditions are true this function draws a separator)
virtual void DrawToolBarButton(wxDC& dc,
int flags = 0,
long style = 0,
int tbarStyle = 0) = 0;
+#endif // wxUSE_TOOLBAR
// draw a (part of) line in the text control
virtual void DrawTextLine(wxDC& dc,
int flags = 0,
int indexAccel = -1) = 0;
+#if wxUSE_SLIDER
+
// draw the slider shaft
virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect,
int step = 1,
int flags = 0,
long style = 0) = 0;
+#endif // wxUSE_SLIDER
+#if wxUSE_MENUS
// draw a menu bar item
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y,
const wxMenuGeometryInfo& geomInfo) = 0;
+#endif // wxUSE_MENUS
+#if wxUSE_STATUSBAR
// draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
// interpreted specially and means "draw the status bar grip" here
virtual void DrawStatusField(wxDC& dc,
const wxRect& rect,
const wxString& label,
int flags = 0, int style = 0) = 0;
+#endif // wxUSE_STATUSBAR
// draw complete frame/dialog titlebar
virtual void DrawFrameTitleBar(wxDC& dc,
// the control looks "nice" if it uses the adjusted rectangle
virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0;
+#if wxUSE_SCROLLBAR
+
// get the size of a scrollbar arrow
virtual wxSize GetScrollbarArrowSize() const = 0;
virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
wxCoord coord) = 0;
+#endif // wxUSE_SCROLLBAR
+
// get the height of a listbox item from the base font height
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0;
// get the margins between/around the toolbar buttons
virtual wxSize GetToolBarMargin() const = 0;
+#if wxUSE_TEXTCTRL
// convert between text rectangle and client rectangle for text controls:
// the former is typicall smaller to leave margins around text
virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rectTotal,
wxCoord *extraSpaceBeyond) const = 0;
+#endif // wxUSE_TEXTCTRL
// get the overhang of a selected tab
virtual wxSize GetTabIndent() const = 0;
// get the padding around the text in a tab
virtual wxSize GetTabPadding() const = 0;
+#if wxUSE_SLIDER
// get the default size of the slider in lesser dimension (i.e. height of a
// horizontal slider or width of a vertical one)
virtual wxCoord GetSliderDim() const = 0;
virtual wxSize GetSliderThumbSize(const wxRect& rect,
int lenThumb,
wxOrientation orient) const = 0;
+#endif // wxUSE_SLIDER
// get the size of one progress bar step (in horz and vertical directions)
virtual wxSize GetProgressBarStep() const = 0;
+#if wxUSE_MENUS
// get the size of rectangle to use in the menubar for the given text rect
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0;
// the returned pointer must be deleted by the caller
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const = 0;
+#endif // wxUSE_MENUS
+#if wxUSE_STATUSBAR
// get the borders around the status bar fields (x and y fields of the
// return value) and also, optionally, the border between the fields
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const = 0;
+#endif // wxUSE_STATUSBAR
// get client area rectangle of top level window (i.e. subtract
// decorations from given rectangle)
int selStart, int selEnd,
int flags);
+#if wxUSE_SCROLLBAR
// standard scrollbar hit testing: this assumes that it only has 2 arrows
// and a thumb, so the themes which have more complicated scrollbars (e.g.
// BeOS) can't use this method
int range,
wxCoord *thumbStart,
wxCoord *thumbEnd);
+#endif // wxUSE_SCROLLBAR
+
};
// ----------------------------------------------------------------------------
int indexAccel = -1)
{ m_renderer->DrawRadioButton(dc, label, bitmap, rect,
flags, align, indexAccel); }
+#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
long style = 0,
int tbarStyle = 0)
{ m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); }
+#endif // wxUSE_TOOLBAR
virtual void DrawTextLine(wxDC& dc,
const wxString& text,
const wxRect& rect,
int accel = -1)
{ m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); }
+#if wxUSE_SLIDER
+
virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect,
int lenThumb,
long style = 0)
{ m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient,
start, end, start, flags, style); }
+#endif // wxUSE_SLIDER
+#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
const wxString& label,
wxCoord y,
const wxMenuGeometryInfo& geomInfo)
{ m_renderer->DrawMenuSeparator(dc, y, geomInfo); }
+#endif // wxUSE_MENUS
+#if wxUSE_STATUSBAR
virtual void DrawStatusField(wxDC& dc,
const wxRect& rect,
const wxString& label,
int flags = 0, int style = 0)
{ m_renderer->DrawStatusField(dc, rect, label, flags, style); }
+#endif // wxUSE_STATUSBAR
virtual void DrawFrameTitleBar(wxDC& dc,
const wxRect& rect,
virtual bool AreScrollbarsInsideBorder() const
{ return m_renderer->AreScrollbarsInsideBorder(); }
+#if wxUSE_SCROLLBAR
virtual wxSize GetScrollbarArrowSize() const
{ return m_renderer->GetScrollbarArrowSize(); }
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
wxCoord coord)
{ return m_renderer->PixelToScrollbar(scrollbar, coord); }
+#endif // wxUSE_SCROLLBAR
+
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
{ return m_renderer->GetListboxItemHeight(fontHeight); }
virtual wxSize GetCheckBitmapSize() const
virtual wxSize GetToolBarMargin() const
{ return m_renderer->GetToolBarMargin(); }
+#if wxUSE_TEXTCTRL
virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const
{ return m_renderer->GetTextTotalArea(text, rect); }
const wxRect& rect,
wxCoord *extraSpaceBeyond) const
{ return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); }
+#endif // wxUSE_TEXTCTRL
virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); }
virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); }
+#if wxUSE_SLIDER
virtual wxCoord GetSliderDim() const
{ return m_renderer->GetSliderDim(); }
virtual wxCoord GetSliderTickLen() const
{ return m_renderer->GetSliderTickLen(); }
+
virtual wxRect GetSliderShaftRect(const wxRect& rect,
int lenThumb,
wxOrientation orient,
int lenThumb,
wxOrientation orient) const
{ return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); }
+#endif // wxUSE_SLIDER
+
virtual wxSize GetProgressBarStep() const
{ return m_renderer->GetProgressBarStep(); }
+
+#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const
{ return m_renderer->GetMenuBarItemSize(sizeText); }
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const
{ return m_renderer->GetMenuGeometry(win, menu); }
+#endif // wxUSE_MENUS
+
+#if wxUSE_STATUSBAR
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const
{ return m_renderer->GetStatusBarBorders(borderBetweenFields); }
+#endif // wxUSE_STATUSBAR
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const
{ return m_renderer->GetFrameClientArea(rect, flags); }
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const
wxStretch stretch = wxSTRETCH_NOT);
private:
+
+#if wxUSE_LISTBOX
// common part of DrawItems() and DrawCheckItems()
void DoDrawItems(const wxListBox *listbox,
size_t itemFirst, size_t itemLast,
bool isCheckLbox = false);
+#endif // wxUSE_LISTBOX
wxWindow *m_window;
wxRenderer *m_renderer;
// NB: this class is implemented in scrolbar.cpp
+#include "wx/defs.h"
+
+#if wxUSE_TIMER
+
#include "wx/timer.h"
// ----------------------------------------------------------------------------
bool m_skipNext;
};
+#endif // wxUSE_TIMER
+
#endif // _WX_UNIV_SCRTIMER_H
class WXDLLEXPORT wxControlRenderer;
class WXDLLEXPORT wxEventLoop;
-class WXDLLEXPORT wxMenu;
-class WXDLLEXPORT wxMenuBar;
+
+#if wxUSE_MENUS
+ class WXDLLEXPORT wxMenu;
+ class WXDLLEXPORT wxMenuBar;
+#endif // wxUSE_MENUS
+
class WXDLLEXPORT wxRenderer;
-class WXDLLEXPORT wxScrollBar;
+
+#if wxUSE_SCROLLBAR
+ class WXDLLEXPORT wxScrollBar;
+#endif // wxUSE_SCROLLBAR
#ifdef __WXX11__
#define wxUSE_TWO_WINDOWS 1
// set the "highlighted" flag and return true if it changed
virtual bool SetCurrent(bool doit = true);
+#if wxUSE_SCROLLBAR
// get the scrollbar (may be NULL) for the given orientation
wxScrollBar *GetScrollbar(int orient) const
{
return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz;
}
+#endif // wxUSE_SCROLLBAR
// methods used by wxColourScheme to choose the colours for this window
// --------------------------------------------------------------------
#endif // __WXMSW__
private:
+
+#if wxUSE_SCROLLBAR
// the window scrollbars
wxScrollBar *m_scrollbarHorz,
*m_scrollbarVert;
+#endif // wxUSE_SCROLLBAR
#if wxUSE_MENUS
// the current modal event loop for the popup menu we show or NULL
// image I/O
// ----------------------------------------------------------------------------
-bool wxImage::LoadFile( const wxString& filename, long type, int index )
+bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
+ long WXUNUSED_UNLESS_STREAMS(type),
+ int WXUNUSED_UNLESS_STREAMS(index) )
{
#if wxUSE_STREAMS
if (wxFileExists(filename))
#endif // wxUSE_STREAMS
}
-bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype, int index )
+bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
+ const wxString& WXUNUSED_UNLESS_STREAMS(mimetype),
+ int WXUNUSED_UNLESS_STREAMS(index) )
{
#if wxUSE_STREAMS
if (wxFileExists(filename))
return false;
}
-bool wxImage::SaveFile( const wxString& filename, int type ) const
+bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
+ int WXUNUSED_UNLESS_STREAMS(type) ) const
{
#if wxUSE_STREAMS
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
return false;
}
-bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) const
+bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
+ const wxString& WXUNUSED_UNLESS_STREAMS(mimetype) ) const
{
#if wxUSE_STREAMS
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
return false;
}
-bool wxImage::CanRead( const wxString &name )
+bool wxImage::CanRead( const wxString& WXUNUSED_UNLESS_STREAMS(name) )
{
#if wxUSE_STREAMS
- wxFileInputStream stream(name);
- return CanRead(stream);
+ wxFileInputStream stream(name);
+ return CanRead(stream);
#else
- return false;
+ return false;
#endif
}
-int wxImage::GetImageCount( const wxString &name, long type )
+int wxImage::GetImageCount( const wxString& WXUNUSED_UNLESS_STREAMS(name),
+ long WXUNUSED_UNLESS_STREAMS(type) )
{
#if wxUSE_STREAMS
- wxFileInputStream stream(name);
- if (stream.Ok())
- return GetImageCount(stream, type);
+ wxFileInputStream stream(name);
+ if (stream.Ok())
+ return GetImageCount(stream, type);
#endif
return 0;
/////////////////////////////////////////////////////////////////////////////
-// Name: common/init.cpp
+// Name: src/common/init.cpp
// Purpose: initialisation for the library
// Author: Vadim Zeitlin
// Modified by:
#include "wx/wxprec.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+ #pragma hdrstop
#endif //__BORLANDC__
#ifndef WX_PRECOMP
#pragma hdrstop
#endif
+#if wxUSE_COLOURPICKERCTRL || \
+ wxUSE_DIRPICKERCTRL || \
+ wxUSE_FILEPICKERCTRL || \
+ wxUSE_FONTPICKERCTRL
+
#include "wx/pickerbase.h"
#ifndef WX_PRECOMP
{
m_margin = newmargin;
}
+
+#endif // Any picker in use
wxPoint pos = event.GetPosition();
// in non-Univ ports the system manages scrollbars for us
-#ifdef __WXUNIVERSAL__
+#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR
// scrollbar on which the click occurred
wxWindow *sbar = NULL;
-#endif // __WXUNIVERSAL__
+#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR
wxWindow *win = (wxWindow *)event.GetEventObject();
}
break;
-#ifdef __WXUNIVERSAL__
+#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR
case wxHT_WINDOW_HORZ_SCROLLBAR:
sbar = win->GetScrollbar(wxHORIZONTAL);
break;
case wxHT_WINDOW_VERT_SCROLLBAR:
sbar = win->GetScrollbar(wxVERTICAL);
break;
-#endif // __WXUNIVERSAL__
+#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR
default:
// forgot to update the switch after adding a new hit test code?
break;
}
-#ifdef __WXUNIVERSAL__
+#if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR
if ( sbar )
{
// translate the event coordinates to the scrollbar ones
(void)sbar->GetEventHandler()->ProcessEvent(event2);
}
-#endif // __WXUNIVERSAL__
+#endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR
}
// ----------------------------------------------------------------------------
wxCurrentId = id + 1;
}
-#if wxUSE_MENUS
-
// ----------------------------------------------------------------------------
// Menu accelerators related functions
// ----------------------------------------------------------------------------
wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out)
{
+#if wxUSE_MENUS
wxString s = wxMenuItem::GetLabelFromText(in);
+#else
+ wxString str(in);
+ wxString s = wxStripMenuCodes(str);
+#endif // wxUSE_MENUS
if ( out )
{
// go smash their buffer if it's not big enough - I love char * params
return out;
}
-#endif // wxUSE_MENUS
-
// ----------------------------------------------------------------------------
// Window search functions
// ----------------------------------------------------------------------------
wxFindMenuItemId (wxFrame * frame, const wxString& menuString, const wxString& itemString)
{
#if wxUSE_MENUS
- wxMenuBar *menuBar = frame->GetMenuBar ();
- if ( menuBar )
- return menuBar->FindMenuItem (menuString, itemString);
+ wxMenuBar *menuBar = frame->GetMenuBar ();
+ if ( menuBar )
+ return menuBar->FindMenuItem (menuString, itemString);
#endif // wxUSE_MENUS
- return wxNOT_FOUND;
+ return wxNOT_FOUND;
}
// Try to find the deepest child that contains 'pt'.
#pragma hdrstop
#endif
+#if wxUSE_MDI
+
#include "wx/generic/mdig.h"
#ifndef WX_PRECOMP
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxGenericMDIChildFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxGenericMDIClientWindow)
-#endif
+#endif // wxUSE_GENERIC_MDI_AS_NATIVE
+
+#endif // wxUSE_MDI
\ No newline at end of file
wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );
+#if wxUSE_STATBMP
// 1) icon
if (style & wxICON_MASK)
{
else
icon_text->Add( icon, 0, wxCENTER );
}
+#endif // wxUSE_STATBMP
+#if wxUSE_STATTEXT
// 2) text
icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 );
topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
+#endif // wxUSE_STATTEXT
#if wxUSE_STATLINE
// 3) static line
#pragma hdrstop
#endif
-#include "wx/generic/region.h"
+#include "wx/region.h"
#ifndef WX_PRECOMP
#include "wx/utils.h"
*/
/* Create a new empty region */
-Region REGION::
-XCreateRegion(void)
+Region REGION::XCreateRegion(void)
{
- Region temp;
+ Region temp = new REGION;
- if (! (temp = new REGION))
+ if (!temp)
return (Region) NULL;
- if (! (temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX )))) {
+
+ temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX ));
+
+ if (!temp->rects)
+ {
free((char *) temp);
return (Region) NULL;
}
return( temp );
}
-bool REGION::
-XClipBox(
- Region r,
- wxRect *rect)
+bool REGION::XClipBox(Region r, wxRect *rect)
{
rect->x = r->extents.x1;
rect->y = r->extents.y1;
{
BOX *prevRects = dstrgn->rects;
- if (! (dstrgn->rects = (BOX *)
+ dstrgn->rects = (BOX *)
realloc((char *) dstrgn->rects,
- (unsigned) rgn->numRects * (sizeof(BOX)))))
+ (unsigned) rgn->numRects * (sizeof(BOX)));
+ if (!dstrgn->rects)
{
free(prevRects);
return;
*/
newReg->size = wxMax(reg1->numRects,reg2->numRects) * 2;
- if (! (newReg->rects = (BoxPtr)
- malloc ((unsigned) (sizeof(BoxRec) * newReg->size)))) {
+ newReg->rects = (BoxPtr)malloc((unsigned) (sizeof(BoxRec) * newReg->size));
+
+ if (!newReg->rects)
+ {
newReg->size = 0;
return;
}
*-----------------------------------------------------------------------
*/
-bool REGION::
-XSubtractRegion(
- Region regM,
- Region regS,
- register Region regD)
+bool REGION::XSubtractRegion(Region regM, Region regS, register Region regD)
{
/* check for trivial reject */
if ( (!(regM->numRects)) || (!(regS->numRects)) ||
return true;
}
-bool REGION::
-XXorRegion(Region sra, Region srb, Region dr)
+bool REGION::XXorRegion(Region sra, Region srb, Region dr)
{
- Region tra, trb;
+ Region tra = XCreateRegion();
+
+ wxCHECK_MSG( tra, false, wxT("region not created") );
+
+ Region trb = XCreateRegion();
+
+ wxCHECK_MSG( trb, false, wxT("region not created") );
- if ((! (tra = XCreateRegion())) || (! (trb = XCreateRegion())))
- return 0;
(void) XSubtractRegion(sra,srb,tra);
(void) XSubtractRegion(srb,sra,trb);
(void) XUnionRegion(tra,trb,dr);
* Check to see if the region is empty. Assumes a region is passed
* as a parameter
*/
-bool REGION::
-XEmptyRegion(
- Region r)
+bool REGION::XEmptyRegion(Region r)
{
if( r->numRects == 0 ) return true;
else return false;
/*
* Check to see if two regions are equal
*/
-bool REGION::
-XEqualRegion(Region r1, Region r2)
+bool REGION::XEqualRegion(Region r1, Region r2)
{
int i;
return true;
}
-bool REGION::
-XPointInRegion(
- Region pRegion,
- int x, int y)
+bool REGION::XPointInRegion(Region pRegion, int x, int y)
{
int i;
return false;
}
-wxRegionContain REGION::
-XRectInRegion(
- register Region region,
- int rx, int ry,
- unsigned int rwidth, unsigned int rheight)
+wxRegionContain REGION::XRectInRegion(register Region region,
+ int rx, int ry,
+ unsigned int rwidth,
+ unsigned int rheight)
{
register BoxPtr pbox;
register BoxPtr pboxEnd;
// wxRenderer: scrollbar geometry
// ----------------------------------------------------------------------------
+#if wxUSE_SCROLLBAR
+
/* static */
void wxRenderer::StandardScrollBarThumbSize(wxCoord length,
int thumbPos,
}
}
+#endif // wxUSE_SCROLLBAR
+
wxRenderer::~wxRenderer()
{
}
}
}
}
+#if wxUSE_IMAGE
else if ( stretch & wxEXPAND )
{
// stretch bitmap to fill the entire control
bmp = wxBitmap(wxImage(bmp.ConvertToImage()).Scale(rect.width, rect.height));
}
+#endif // wxUSE_IMAGE
else // not stretched, not tiled
{
if ( alignment & wxALIGN_RIGHT )
dc.DrawBitmap(bmp, x, y, true /* use mask */);
}
+#if wxUSE_SCROLLBAR
+
void wxControlRenderer::DrawScrollbar(const wxScrollBar *scrollbar,
int WXUNUSED(thumbPosOld))
{
}
}
+#endif // wxUSE_SCROLLBAR
+
void wxControlRenderer::DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
wxASSERT_MSG( x1 == x2 || y1 == y2,
// ----------------------------------------------------------------------------
bool wxFrame::Create(wxWindow *parent,
- wxWindowID id,
- const wxString& title,
- const wxPoint& pos,
- const wxSize& size,
- long style,
- const wxString& name)
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
{
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return false;
m_arrowPressed = wxScrollArrows::Arrow_None;
m_window = NULL;
m_btnCapture = -1;
+#if wxUSE_TIMER
m_timerScroll = NULL;
+#endif // wxUSE_TIMER
}
~wxScrollArrowCaptureData()
if ( m_window )
m_window->ReleaseMouse();
+#if wxUSE_TIMER
delete m_timerScroll;
+#endif // wxUSE_TIMER
}
// the arrow being held pressed (may be Arrow_None)
// the window which has captured the mouse
wxWindow *m_window;
+#if wxUSE_TIMER
// the timer for generating the scroll events
wxScrollTimer *m_timerScroll;
+#endif
};
// ----------------------------------------------------------------------------
// wxScrollArrowTimer: a wxScrollTimer which calls OnArrow()
// ----------------------------------------------------------------------------
+#if wxUSE_TIMER
+
class wxScrollArrowTimer : public wxScrollTimer
{
public:
wxScrollArrows::Arrow m_arrow;
};
+#endif // wxUSE_TIMER
+
// ============================================================================
// implementation of wxScrollArrows
// ============================================================================
arrow = m_control->HitTest(event.GetPosition());
}
+#if wxUSE_TIMER
if ( m_captureData && m_captureData->m_timerScroll)
{
// the mouse is captured, we may want to pause scrolling if it goes
return false;
}
+#endif // wxUSE_TIMER
// reset the wxCONTROL_CURRENT flag for the arrows which don't have the
// mouse and set it for the one which has
m_captureData->m_window = m_control->GetWindow();
m_captureData->m_window->CaptureMouse();
- // start scrolling
+#if wxUSE_TIMER
+ // start scrolling
wxScrollArrowTimer *tmpTimerScroll =
new wxScrollArrowTimer(m_control, arrow);
+#endif // wxUSE_TIMER
- // Because in some cases wxScrollArrowTimer can cause
- // m_captureData to be destructed we need to test if it
+ // Because in some cases wxScrollArrowTimer can cause
+ // m_captureData to be destructed we need to test if it
// is still valid before using.
if (m_captureData)
{
+#if wxUSE_TIMER
m_captureData->m_timerScroll = tmpTimerScroll;
+#endif // wxUSE_TIMER
m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, true);
}
else
{
+#if wxUSE_TIMER
delete tmpTimerScroll;
+#endif // wxUSE_TIMER
}
}
//else: mouse already captured, nothing to do
#endif // wxUSE_SCROLLBAR
+#if wxUSE_TIMER
+
// ----------------------------------------------------------------------------
// wxScrollTimer
// ----------------------------------------------------------------------------
(void)DoNotify();
}
}
+
+#endif // wxUSE_TIMER
/////////////////////////////////////////////////////////////////////////////
-// Name: univ/scrthumb.cpp
+// Name: src/univ/scrthumb.cpp
// Purpose: wxScrollThumb and related classes
// Author: Vadim Zeitlin
// Modified by:
#ifndef WX_PRECOMP
#include "wx/window.h"
- #include "wx/renderer.h"
#endif // WX_PRECOMP
+#include "wx/renderer.h"
#include "wx/univ/scrtimer.h"
#include "wx/univ/scrthumb.h"
m_window->ReleaseMouse();
}
+#if wxUSE_TIMER
delete m_timerScroll;
+#endif // wxUSE_TIMER
}
// the thumb part being held pressed
// wxScrollTimer: the timer used when the arrow is kept pressed
// ----------------------------------------------------------------------------
+#if wxUSE_TIMER
+
class wxScrollThumbTimer : public wxScrollTimer
{
public:
int m_inc;
};
+#endif // wxUSE_TIMER
+
// ============================================================================
// implementation
// ============================================================================
// generate an additional event if we start dragging the thumb
m_control->OnThumbDragStart(GetThumbPos(event));
}
+#if wxUSE_TIMER
else // not the thumb
{
// start timer for auto scrolling when the user presses the mouse
m_captureData->m_timerScroll =
new wxScrollThumbTimer(m_control, shaftPart);
}
+#endif // wxUSE_TIMER
}
// release mouse if the *same* button went up
else if ( HasCapture() && (btn == m_captureData->m_btnCapture) )
wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1);
+#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
int flags = 0,
long style = 0,
int tbarStyle = 0);
+#endif // wxUSE_TOOLBAR
virtual void DrawTextLine(wxDC& dc,
const wxString& text,
int flags = 0,
int indexAccel = -1);
+#if wxUSE_SLIDER
virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect,
int lenThumb,
{
// we don't have the ticks in GTK version
}
+#endif // wxUSE_SLIDER
+#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
const wxString& label,
virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y,
const wxMenuGeometryInfo& geomInfo);
+#endif // wxUSE_MENUS
+#if wxUSE_STATUSBAR
virtual void DrawStatusField(wxDC& dc,
const wxRect& rect,
const wxString& label,
int flags = 0, int style = 0);
+#endif // wxUSE_STATUSBAR
virtual void DrawFrameTitleBar(wxDC& dc,
const wxRect& rect,
// geometry and hit testing
virtual wxSize GetScrollbarArrowSize() const
{ return m_sizeScrollbarArrow; }
+#if wxUSE_SCROLLBAR
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem,
int thumbPos = -1) const;
virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
int thumbPos = -1);
virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
+#endif // wxUSE_SCROLLBAR
+
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
{ return fontHeight + 2; }
virtual wxSize GetCheckBitmapSize() const
virtual wxSize GetToolBarMargin() const
{ return wxSize(6, 6); }
+#if wxUSE_TEXTCTRL
virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const;
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect,
wxCoord *extraSpaceBeyond) const;
+#endif // wxUSE_TEXTCTRL
virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
virtual wxSize GetTabPadding() const { return wxSize(6, 6); }
+#if wxUSE_SLIDER
virtual wxCoord GetSliderDim() const { return 15; }
virtual wxCoord GetSliderTickLen() const { return 0; }
virtual wxRect GetSliderShaftRect(const wxRect& rect,
virtual wxSize GetSliderThumbSize(const wxRect& rect,
int lenThumb,
wxOrientation orient) const;
+#endif // wxUSE_SLIDER
+
virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
+#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const;
+#endif // wxUSE_MENUS
+#if wxUSE_STATUSBAR
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
+#endif // wxUSE_STATUSBAR
// helpers for "wxBitmap wxColourScheme::Get()"
void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
// rect is drawn with DrawAntiShadedRect() and not DrawShadedRect())
void DrawAntiRaisedBorder(wxDC& dc, wxRect *rect);
+#if wxUSE_SCROLLBAR
// returns the size of the arrow for the scrollbar (depends on
// orientation)
wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar) const
return size;
}
+#endif // wxUSE_SCROLLBAR
// get the line wrap indicator bitmap
wxBitmap GetLineWrapBitmap() const;
wxGTKRenderer *m_renderer;
};
+#if wxUSE_SCROLLBAR
+
class wxGTKScrollBarInputHandler : public wxStdScrollBarInputHandler
{
public:
}
};
+#endif // wxUSE_SCROLLBAR
+
+#if wxUSE_CHECKBOX
+
class wxGTKCheckboxInputHandler : public wxStdCheckboxInputHandler
{
public:
bool pressed);
};
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_TEXTCTRL
+
class wxGTKTextCtrlInputHandler : public wxStdTextCtrlInputHandler
{
public:
bool pressed);
};
+#endif // wxUSE_TEXTCTRL
+
// ----------------------------------------------------------------------------
// wxGTKColourScheme: uses the standard GTK colours
// ----------------------------------------------------------------------------
wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control)
{
- wxInputHandler *handler;
+ wxInputHandler *handler = NULL;
int n = m_handlerNames.Index(control);
if ( n == wxNOT_FOUND )
{
// create a new handler
if ( control == wxINP_HANDLER_SCROLLBAR )
+ {
+#if wxUSE_SCROLLBAR
handler = new wxGTKScrollBarInputHandler(m_renderer,
GetDefaultInputHandler());
+#endif // wxUSE_SCROLLBAR
+ }
#if wxUSE_BUTTON
else if ( control == wxINP_HANDLER_BUTTON )
handler = new wxStdButtonInputHandler(GetDefaultInputHandler());
#endif // wxUSE_TOOLBAR
else if ( control == wxINP_HANDLER_TOPLEVEL )
handler = new wxStdFrameInputHandler(GetDefaultInputHandler());
- else
+
+ if(!handler)
handler = GetDefaultInputHandler();
n = m_handlerNames.Add(control);
// and for the states for which we don't have any specific colours
if ( !col.Ok() || (flags != 0) )
{
+#if wxUSE_SCROLLBAR
if ( wxDynamicCast(win, wxScrollBar) )
col = Get(SCROLLBAR);
- else if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() )
+ else
+#endif //wxUSE_SCROLLBAR
+ if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() )
col = Get(CONTROL_CURRENT);
else if ( flags & wxCONTROL_PRESSED )
col = Get(CONTROL_PRESSED);
case GAUGE: return Get(CONTROL_CURRENT);
+ case TITLEBAR: return wxColour(0xaeaaae);
+ case TITLEBAR_ACTIVE: return wxColour(0x820300);
+ case TITLEBAR_TEXT: return wxColour(0xc0c0c0);
+ case TITLEBAR_ACTIVE_TEXT:
+ return *wxWHITE;
+
+ case DESKTOP: return *wxBLACK;
+
case MAX:
default:
wxFAIL_MSG(_T("invalid standard colour"));
flags, align, indexAccel);
}
+#if wxUSE_TOOLBAR
void wxGTKRenderer::DrawToolBarButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
}
}
}
+#endif // wxUSE_TOOLBAR
// ----------------------------------------------------------------------------
// text control
// ----------------------------------------------------------------------------
+#if wxUSE_TEXTCTRL
+
wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text),
const wxRect& rect) const
{
return rectText;
}
+#endif // wxUSE_TEXTCTRL
+
void wxGTKRenderer::DrawTextLine(wxDC& dc,
const wxString& text,
const wxRect& rect,
dcMem.SetFont(dc.GetFont());
dcMem.SetTextForeground(dc.GetTextForeground());
dcMem.Clear();
- bitmapRotated = wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) );
+ bitmapRotated =
+#if wxUSE_IMAGE
+ wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) )
+#else
+ bitmap
+#endif // wxUSE_IMAGE
+ ;
dcMem.DrawLabel(label, bitmapRotated, rectLabel, wxALIGN_CENTRE, indexAccel);
dcMem.SelectObject(wxNullBitmap);
bitmapMem = bitmapMem.GetSubBitmap(rectLabel);
- bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT));
+#if wxUSE_IMAGE
+ bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT))
+#endif
+ ;
+
dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false);
}
else
}
}
+#if wxUSE_SLIDER
+
// ----------------------------------------------------------------------------
// slider
// ----------------------------------------------------------------------------
DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
}
+#endif // wxUSE_SLIDER
+
+#if wxUSE_MENUS
+
// ----------------------------------------------------------------------------
// menu and menubar
// ----------------------------------------------------------------------------
return gi;
}
+#endif // wxUSE_MENUS
+
+#if wxUSE_STATUSBAR
+
// ----------------------------------------------------------------------------
// status bar
// ----------------------------------------------------------------------------
{
}
+#endif // wxUSE_STATUSBAR
+
// ----------------------------------------------------------------------------
// combobox
// ----------------------------------------------------------------------------
DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
}
+#if wxUSE_SCROLLBAR
wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem,
int thumbPos) const
return StandardPixelToScrollbar(scrollbar, coord,
GetScrollbarArrowSize(scrollbar));
}
+#endif // wxUSE_SCROLLBAR
// ----------------------------------------------------------------------------
// size adjustments
}
} else
#endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN
+#if wxUSE_SCROLLBAR
if ( wxDynamicCast(window, wxScrollBar) )
{
// we only set the width of vert scrollbars and height of the
size->x = m_sizeScrollbarArrow.x;
}
else
+#endif // wxUSE_SCROLLBAR
{
// take into account the border width
wxRect rectBorder = GetBorderDimensions(window->GetBorder());
return true;
}
+#if wxUSE_CHECKBOX
+
// ----------------------------------------------------------------------------
// wxGTKCheckboxInputHandler
// ----------------------------------------------------------------------------
return false;
}
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_TEXTCTRL
+
// ----------------------------------------------------------------------------
// wxGTKTextCtrlInputHandler
// ----------------------------------------------------------------------------
return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
}
+
+#endif // wxUSE_TEXTCTRL
int flags = 0,
wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1);
+#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
int flags = 0,
long style = 0,
int tbarStyle = 0);
+#endif // wxUSE_TOOLBAR
virtual void DrawTextLine(wxDC& dc,
const wxString& text,
const wxRect& rect,
int flags = 0,
int indexAccel = -1);
+#if wxUSE_SLIDER
virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect,
int lenThumb,
int step = 1,
int flags = 0,
long style = 0);
+#endif // wxUSE_SLIDER
+#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
const wxString& label,
virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y,
const wxMenuGeometryInfo& geomInfo);
+#endif // wxUSE_MENUS
+#if wxUSE_STATUSBAR
virtual void DrawStatusField(wxDC& dc,
const wxRect& rect,
const wxString& label,
int flags = 0, int style = 0);
+#endif // wxUSE_STATUSBAR
// titlebars
virtual void DrawFrameTitleBar(wxDC& dc,
virtual wxSize GetScrollbarArrowSize() const
{ return m_sizeScrollbarArrow; }
+
+#if wxUSE_SCROLLBAR
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem,
int thumbPos = -1) const;
virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
int thumbPos = -1);
virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
+#endif // wxUSE_SCROLLBAR
+
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
{ return fontHeight + 2; }
virtual wxSize GetCheckBitmapSize() const
virtual wxSize GetToolBarMargin() const
{ return wxSize(4, 4); }
+#if wxUSE_TEXTCTRL
virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const;
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect,
wxCoord *extraSpaceBeyond) const;
+#endif // wxUSE_TEXTCTRL
virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
virtual wxSize GetTabPadding() const { return wxSize(6, 5); }
+#if wxUSE_SLIDER
+
virtual wxCoord GetSliderDim() const { return SLIDER_THUMB_LENGTH + 2*BORDER_THICKNESS; }
virtual wxCoord GetSliderTickLen() const { return SLIDER_TICK_LENGTH; }
virtual wxRect GetSliderShaftRect(const wxRect& rect,
virtual wxSize GetSliderThumbSize(const wxRect& rect,
int lenThumb,
wxOrientation orient) const;
+#endif // wxUSE_SLIDER
+
virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
+#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const;
+#endif // wxUSE_MENUS
+#if wxUSE_STATUSBAR
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
+#endif // wxUSE_STATUSBAR
protected:
// helper of DrawLabel() and DrawCheckOrRadioButton()
wxWin32Renderer *m_renderer;
};
+#if wxUSE_SCROLLBAR
class wxWin32ScrollBarInputHandler : public wxStdScrollBarInputHandler
{
public:
// we remember the interval of the timer to be able to restart it
int m_interval;
};
+#endif // wxUSE_SCROLLBAR
+#if wxUSE_CHECKBOX
class wxWin32CheckboxInputHandler : public wxStdCheckboxInputHandler
{
public:
const wxKeyEvent& event,
bool pressed);
};
+#endif // wxUSE_CHECKBOX
+#if wxUSE_TEXTCTRL
class wxWin32TextCtrlInputHandler : public wxStdTextCtrlInputHandler
{
public:
const wxKeyEvent& event,
bool pressed);
};
+#endif // wxUSE_TEXTCTRL
class wxWin32StatusBarInputHandler : public wxStdInputHandler
{
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
+#if wxUSE_MENUS
void PopupSystemMenu(wxTopLevelWindow *window, const wxPoint& pos) const;
+#endif // wxUSE_MENUS
private:
// was the mouse over the grip last time we checked?
wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control)
{
- wxInputHandler *handler;
+ wxInputHandler *handler = NULL;
int n = m_handlerNames.Index(control);
if ( n == wxNOT_FOUND )
{
// create a new handler
if ( control == wxINP_HANDLER_SCROLLBAR )
+ {
+#if wxUSE_SCROLLBAR
handler = new wxWin32ScrollBarInputHandler(m_renderer,
GetDefaultInputHandler());
+#endif // wxUSE_SCROLLBAR
+ }
#if wxUSE_BUTTON
else if ( control == wxINP_HANDLER_BUTTON )
handler = new wxStdButtonInputHandler(GetDefaultInputHandler());
#endif // wxUSE_TOOLBAR
else if ( control == wxINP_HANDLER_TOPLEVEL )
handler = new wxWin32FrameInputHandler(GetDefaultInputHandler());
- else
+
+ if(!handler)
handler = GetDefaultInputHandler();
n = m_handlerNames.Add(control);
if ( !win->ShouldInheritColours() )
{
+#if wxUSE_TEXTCTRL
wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
+#endif // wxUSE_TEXTCTRL
#if wxUSE_LISTBOX
wxListBox* listBox = wxDynamicCast(win, wxListBox);
-#endif
+#endif // wxUSE_LISTBOX
+
+#if wxUSE_TEXTCTRL
if ( text
#if wxUSE_LISTBOX
|| listBox
}
}
}
+#endif // wxUSE_TEXTCTRL
if (!col.Ok())
col = Get(CONTROL); // Most controls should be this colour, not WINDOW
// and for the states for which we don't have any specific colours
if ( !col.Ok() || (flags & wxCONTROL_PRESSED) != 0 )
{
+#if wxUSE_SCROLLBAR
if ( wxDynamicCast(win, wxScrollBar) )
col = Get(flags & wxCONTROL_PRESSED ? SCROLLBAR_PRESSED
: SCROLLBAR);
else
+#endif // wxUSE_SCROLLBAR
col = Get(CONTROL);
}
}
0); // no focus rect offset for checkboxes
}
+#if wxUSE_TOOLBAR
void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
}
// don't draw wxTOOL_STYLE_CONTROL
}
+#endif // wxUSE_TOOLBAR
// ----------------------------------------------------------------------------
// text control
dcMem.SetFont(dc.GetFont());
dcMem.SetTextForeground(dc.GetTextForeground());
dcMem.Clear();
- bitmapRotated = wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) );
+ bitmapRotated =
+#if wxUSE_IMAGE
+ wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) )
+#else
+ bitmap
+#endif // wxUSE_IMAGE
+ ;
DrawButtonLabel(dcMem, label, bitmapRotated, rectLabel,
flags, wxALIGN_CENTRE, indexAccel);
dcMem.SelectObject(wxNullBitmap);
bitmapMem = bitmapMem.GetSubBitmap(rectLabel);
+#if wxUSE_IMAGE
bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT));
+#endif // wxUSE_IMAGE
dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false);
}
else
#undef REVERSE_FOR_VERTICAL
}
+#if wxUSE_SLIDER
+
// ----------------------------------------------------------------------------
// slider
// ----------------------------------------------------------------------------
}
}
+#endif // wxUSE_SLIDER
+
+#if wxUSE_MENUS
+
// ----------------------------------------------------------------------------
// menu and menubar
// ----------------------------------------------------------------------------
return gi;
}
+#endif // wxUSE_MENUS
+
+#if wxUSE_STATUSBAR
+
// ----------------------------------------------------------------------------
// status bar
// ----------------------------------------------------------------------------
DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
}
+#endif // wxUSE_STATUSBAR
+
// ----------------------------------------------------------------------------
// combobox
// ----------------------------------------------------------------------------
DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
}
+#if wxUSE_SCROLLBAR
+
wxRect wxWin32Renderer::GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem,
int thumbPos) const
return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow);
}
+#endif // wxUSE_SCROLLBAR
+
// ----------------------------------------------------------------------------
// top level windows
// ----------------------------------------------------------------------------
}
+#if wxUSE_TEXTCTRL
+
// ----------------------------------------------------------------------------
// text control geometry
// ----------------------------------------------------------------------------
return rectText;
}
+#endif // wxUSE_TEXTCTRL
+
// ----------------------------------------------------------------------------
// size adjustments
// ----------------------------------------------------------------------------
return false;
}
+#if wxUSE_SCROLLBAR
+
// ----------------------------------------------------------------------------
// wxWin32ScrollBarInputHandler
// ----------------------------------------------------------------------------
return wxStdScrollBarInputHandler::HandleMouseMove(control, event);
}
+#endif // wxUSE_SCROLLBAR
+
+#if wxUSE_CHECKBOX
+
// ----------------------------------------------------------------------------
// wxWin32CheckboxInputHandler
// ----------------------------------------------------------------------------
return false;
}
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_TEXTCTRL
+
// ----------------------------------------------------------------------------
// wxWin32TextCtrlInputHandler
// ----------------------------------------------------------------------------
return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
}
+#endif // wxUSE_TEXTCTRL
+
+#if wxUSE_STATUSBAR
+
// ----------------------------------------------------------------------------
// wxWin32StatusBarInputHandler
// ----------------------------------------------------------------------------
return wxStdInputHandler::HandleMouseMove(consumer, event);
}
+#endif // wxUSE_STATUSBAR
+
// ----------------------------------------------------------------------------
// wxWin32FrameInputHandler
// ----------------------------------------------------------------------------
m_wnd->SetAcceleratorTable(wxNullAcceleratorTable);
#endif
+#if wxUSE_MENUS
m_inputHnd->PopupSystemMenu(m_wnd, pt);
+#endif // wxUSE_MENUS
#if wxUSE_ACCEL
m_wnd->SetAcceleratorTable(table);
(hit == wxHT_TOPLEVEL_TITLEBAR ||
hit == wxHT_TOPLEVEL_ICON)) )
{
+#if wxUSE_MENUS
PopupSystemMenu(tlw, event.GetPosition());
+#endif // wxUSE_MENUS
return true;
}
}
return wxStdFrameInputHandler::HandleMouse(consumer, event);
}
+#if wxUSE_MENUS
+
void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window,
const wxPoint& pos) const
{
delete menu;
}
+#endif // wxUSE_MENUS
+
bool wxWin32FrameInputHandler::HandleActivation(wxInputConsumer *consumer,
bool activated)
{
else
{
// get the window rect
- wxRect rect;
- wxSize size = GetSize();
- rect.x =
- rect.y = 0;
- rect.width = size.x;
- rect.height = size.y;
+ wxRect rect(GetSize());
wxWindowDC dc(this);
m_renderer->DrawFrameTitleBar(dc, rect,
m_titlebarIcon = wxNullIcon;
else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y )
m_titlebarIcon = icon;
+#if wxUSE_IMAGE
else
{
wxImage img = bmp1.ConvertToImage();
img.Rescale(size.x, size.y);
m_titlebarIcon.CopyFromBitmap(wxBitmap(img));
}
+#endif // wxUSE_IMAGE
}
}
}
void wxWindow::Init()
{
+#if wxUSE_SCROLLBAR
m_scrollbarVert =
m_scrollbarHorz = (wxScrollBar *)NULL;
+#endif // wxUSE_SCROLLBAR
m_isCurrent = false;
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( true );
#endif
+#if wxUSE_SCROLLBAR
m_scrollbarVert = new wxScrollBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxSB_VERTICAL);
+#endif // wxUSE_SCROLLBAR
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( false );
#endif
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( true );
#endif
+#if wxUSE_SCROLLBAR
m_scrollbarHorz = new wxScrollBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxSB_HORIZONTAL);
+#endif // wxUSE_SCROLLBAR
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( false );
#endif
}
+#if wxUSE_SCROLLBAR
if (m_scrollbarHorz || m_scrollbarVert)
{
// position it/them
PositionScrollbars();
}
+#endif // wxUSE_SCROLLBAR
return true;
}
if ( m_renderer )
{
// get the window rect
- wxRect rect;
- wxSize size = GetSize();
- rect.x =
- rect.y = 0;
- rect.width = size.x;
- rect.height = size.y;
+ wxRect rect(GetSize());
+#if wxUSE_SCROLLBAR
// if the scrollbars are outside the border, we must adjust the rect to
// exclude them
if ( !m_renderer->AreScrollbarsInsideBorder() )
if ( scrollbar )
rect.height -= scrollbar->GetSize().y;
}
+#endif // wxUSE_SCROLLBAR
// get the DC and draw the border on it
wxWindowDC dc(this);
DoDrawBackground(*event.GetDC());
+#if wxUSE_SCROLLBAR
// if we have both scrollbars, we also have a square in the corner between
// them which we must paint
if ( m_scrollbarVert && m_scrollbarHorz )
m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner);
}
}
+#endif // wxUSE_SCROLLBAR
}
bool wxWindow::DoDrawBackground(wxDC& dc)
{
event.Skip();
+#if wxUSE_SCROLLBAR
if ( m_scrollbarVert || m_scrollbarHorz )
{
PositionScrollbars();
}
+#endif // wxUSE_SCROLLBAR
#if 0 // ndef __WXMSW__
// Refresh the area (strip) previously occupied by the border
if ( width )
{
+#if wxUSE_SCROLLBAR
// in any case, take account of the scrollbar
if ( m_scrollbarVert )
w -= m_scrollbarVert->GetSize().x;
+#endif // wxUSE_SCROLLBAR
// if we don't have scrollbar or if it is outside the border (and not
// blended into it), take account of the right border as well
- if ( !m_scrollbarVert || inside )
+ if (
+#if wxUSE_SCROLLBAR
+ !m_scrollbarVert ||
+#endif // wxUSE_SCROLLBAR
+ inside )
w -= rectBorder.width;
// and always account for the left border
if ( height )
{
+#if wxUSE_SCROLLBAR
if ( m_scrollbarHorz )
h -= m_scrollbarHorz->GetSize().y;
+#endif // wxUSE_SCROLLBAR
- if ( !m_scrollbarHorz || inside )
+ if (
+#if wxUSE_SCROLLBAR
+ !m_scrollbarHorz ||
+#endif // wxUSE_SCROLLBAR
+ inside )
h -= rectBorder.height;
*height = h - rectBorder.y;
// had been called before)
bool inside = m_renderer->AreScrollbarsInsideBorder();
wxSize size = GetSize();
+#if wxUSE_SCROLLBAR
if ( m_scrollbarVert )
width += size.x - m_scrollbarVert->GetPosition().x;
- if ( !m_scrollbarVert || inside )
+#endif // wxUSE_SCROLLBAR
+ if (
+#if wxUSE_SCROLLBAR
+ !m_scrollbarVert ||
+#endif // wxUSE_SCROLLBAR
+ inside )
width += rectBorder.width;
+#if wxUSE_SCROLLBAR
if ( m_scrollbarHorz )
height += size.y - m_scrollbarHorz->GetPosition().y;
- if ( !m_scrollbarHorz || inside )
+#endif // wxUSE_SCROLLBAR
+ if (
+#if wxUSE_SCROLLBAR
+ !m_scrollbarHorz ||
+#endif // wxUSE_SCROLLBAR
+ inside )
height += rectBorder.height;
wxWindowNative::DoSetClientSize(width, height);
wxHitTest wxWindow::DoHitTest(wxCoord x, wxCoord y) const
{
wxHitTest ht = wxWindowNative::DoHitTest(x, y);
+
+#if wxUSE_SCROLLBAR
if ( ht == wxHT_WINDOW_INSIDE )
{
if ( m_scrollbarVert && x >= m_scrollbarVert->GetPosition().x )
: wxHT_WINDOW_HORZ_SCROLLBAR;
}
}
+#endif // wxUSE_SCROLLBAR
return ht;
}
void wxWindow::RefreshScrollbars()
{
+#if wxUSE_SCROLLBAR
if ( m_scrollbarHorz )
m_scrollbarHorz->Refresh();
if ( m_scrollbarVert )
m_scrollbarVert->Refresh();
+#endif // wxUSE_SCROLLBAR
}
void wxWindow::PositionScrollbars()
{
+#if wxUSE_SCROLLBAR
// do not use GetClientSize/Rect as it relies on the scrollbars being
// correctly positioned
}
RefreshScrollbars();
+#endif // wxUSE_SCROLLBAR
}
void wxWindow::SetScrollbar(int orient,
int range,
bool refresh)
{
+#if wxUSE_SCROLLBAR
wxASSERT_MSG( pageSize <= range,
_T("page size can't be greater than range") );
(void)GetEventHandler()->ProcessEvent(event);
#endif
}
+#else
+ wxUnusedVar(orient);
+ wxUnusedVar(pos);
+ wxUnusedVar(pageSize);
+ wxUnusedVar(range);
+ wxUnusedVar(refresh);
+#endif // wxUSE_SCROLLBAR
}
void wxWindow::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
{
+#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient);
if (scrollbar)
if ( refresh )
Refresh();
#endif
+#else
+ wxUnusedVar(orient);
+ wxUnusedVar(pos);
+#endif // wxUSE_SCROLLBAR
}
int wxWindow::GetScrollPos(int orient) const
{
+#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient);
return scrollbar ? scrollbar->GetThumbPosition() : 0;
+#else
+ wxUnusedVar(orient);
+ return 0;
+#endif // wxUSE_SCROLLBAR
}
int wxWindow::GetScrollThumb(int orient) const
{
+#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient);
return scrollbar ? scrollbar->GetThumbSize() : 0;
+#else
+ wxUnusedVar(orient);
+ return 0;
+#endif // wxUSE_SCROLLBAR
}
int wxWindow::GetScrollRange(int orient) const
{
+#if wxUSE_SCROLLBAR
wxScrollBar *scrollbar = GetScrollbar(orient);
return scrollbar ? scrollbar->GetRange() : 0;
+#else
+ wxUnusedVar(orient);
+ return 0;
+#endif // wxUSE_SCROLLBAR
}
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
node; node = node->GetNext())
{
wxWindow *child = node->GetData();
+#if wxUSE_SCROLLBAR
if ( child == m_scrollbarVert || child == m_scrollbarHorz )
continue;
+#endif // wxUSE_SCROLLBAR
// VS: Scrolling children has non-trivial semantics. If rect=NULL then
// it is easy: we scroll all children. Otherwise it gets