📄 mono.cpp
字号:
///////////////////////////////////////////////////////////////////////////////// Name: src/univ/themes/mono.cpp// Purpose: wxUniversal theme for monochrome displays// Author: Vadim Zeitlin// Modified by:// Created: 2006-08-27// RCS-ID: $Id: mono.cpp,v 1.16 2006/10/30 10:19:21 VS Exp $// Copyright: (c) 2006 REA Elektronik GmbH// Licence: wxWindows licence///////////////////////////////////////////////////////////////////////////////// ===========================================================================// declarations// ===========================================================================// ---------------------------------------------------------------------------// headers// ---------------------------------------------------------------------------// for compilers that support precompilation, includes "wx.h".#include "wx/wxprec.h"#ifdef __BORLANDC__ #pragma hdrstop#endif#include "wx/univ/theme.h"#if wxUSE_THEME_MONO#ifndef WX_PRECOMP #include "wx/dc.h"#endif // WX_PRECOMP#include "wx/artprov.h"#include "wx/univ/stdrend.h"#include "wx/univ/inphand.h"#include "wx/univ/colschem.h"class wxMonoColourScheme;#define wxMONO_BG_COL (*wxWHITE)#define wxMONO_FG_COL (*wxBLACK)// ----------------------------------------------------------------------------// wxMonoRenderer: draw the GUI elements in simplest possible way// ----------------------------------------------------------------------------// Warning: many of the methods here are not implemented, the code won't work// if any but a few wxUSE_XXXs are onclass wxMonoRenderer : public wxStdRenderer{public: wxMonoRenderer(const wxColourScheme *scheme); virtual void DrawButtonLabel(wxDC& dc, const wxString& label, const wxBitmap& image, const wxRect& rect, int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, wxRect *rectBounds = NULL); virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0); virtual void DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags = 0, wxRect *rectIn = NULL); virtual void DrawHorizontalLine(wxDC& dc, wxCoord y, wxCoord x1, wxCoord x2); virtual void DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2); virtual void DrawArrow(wxDC& dc, wxDirection dir, const wxRect& rect, int flags = 0); virtual void DrawScrollbarThumb(wxDC& dc, wxOrientation orient, const wxRect& rect, int flags = 0); virtual void DrawScrollbarShaft(wxDC& dc, wxOrientation orient, const wxRect& rect, int flags = 0);#if wxUSE_TOOLBAR virtual void DrawToolBarButton(wxDC& dc, const wxString& label, const wxBitmap& bitmap, const wxRect& rect, int flags = 0, long style = 0, int tbarStyle = 0);#endif // wxUSE_TOOLBAR#if wxUSE_NOTEBOOK virtual void DrawTab(wxDC& dc, const wxRect& rect, wxDirection dir, const wxString& label, const wxBitmap& bitmap = wxNullBitmap, int flags = 0, int indexAccel = -1);#endif // wxUSE_NOTEBOOK#if wxUSE_SLIDER virtual void DrawSliderShaft(wxDC& dc, const wxRect& rect, int lenThumb, wxOrientation orient, int flags = 0, long style = 0, wxRect *rectShaft = NULL); virtual void DrawSliderThumb(wxDC& dc, const wxRect& rect, wxOrientation orient, int flags = 0, long style = 0); virtual void DrawSliderTicks(wxDC& dc, const wxRect& rect, int lenThumb, wxOrientation orient, int start, int end, 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, int flags = 0, int indexAccel = -1); virtual void DrawMenuItem(wxDC& dc, wxCoord y, const wxMenuGeometryInfo& geometryInfo, const wxString& label, const wxString& accel, const wxBitmap& bitmap = wxNullBitmap, int flags = 0, int indexAccel = -1); virtual void DrawMenuSeparator(wxDC& dc, wxCoord y, const wxMenuGeometryInfo& geomInfo);#endif // wxUSE_MENUS#if wxUSE_COMBOBOX virtual void GetComboBitmaps(wxBitmap *bmpNormal, wxBitmap *bmpFocus, wxBitmap *bmpPressed, wxBitmap *bmpDisabled);#endif // wxUSE_COMBOBOX virtual wxRect GetBorderDimensions(wxBorder border) const;#if wxUSE_SCROLLBAR virtual wxSize GetScrollbarArrowSize() const { return GetStdBmpSize(); }#endif // wxUSE_SCROLLBAR virtual wxSize GetCheckBitmapSize() const { return GetStdBmpSize(); } virtual wxSize GetRadioBitmapSize() const { return GetStdBmpSize(); }#if wxUSE_TOOLBAR virtual wxSize GetToolBarButtonSize(wxCoord *separator) const; virtual wxSize GetToolBarMargin() const;#endif // wxUSE_TOOLBAR#if wxUSE_NOTEBOOK virtual wxSize GetTabIndent() const; virtual wxSize GetTabPadding() const;#endif // wxUSE_NOTEBOOK#if wxUSE_SLIDER virtual wxCoord GetSliderDim() const; virtual wxCoord GetSliderTickLen() const; virtual wxRect GetSliderShaftRect(const wxRect& rect, int lenThumb, wxOrientation orient, long style = 0) const; virtual wxSize GetSliderThumbSize(const wxRect& rect, int lenThumb, wxOrientation orient) const;#endif // wxUSE_SLIDER virtual wxSize GetProgressBarStep() const;#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 wxCoord GetStatusBarBorderBetweenFields() const; virtual wxSize GetStatusBarFieldMargins() const;#endif // wxUSE_STATUSBARprotected: // override base class border drawing routines: we always draw just a // single simple border void DrawSimpleBorder(wxDC& dc, wxRect *rect) { DrawRect(dc, rect, m_penFg); } virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect) { DrawSimpleBorder(dc, rect); } virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect) { DrawSimpleBorder(dc, rect); } virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect) { DrawSimpleBorder(dc, rect); } virtual void DrawBoxBorder(wxDC& dc, wxRect *rect) { DrawSimpleBorder(dc, rect); } virtual void DrawStaticBorder(wxDC& dc, wxRect *rect) { DrawSimpleBorder(dc, rect); } virtual void DrawExtraBorder(wxDC& WXUNUSED(dc), wxRect * WXUNUSED(rect)) { /* no extra borders for us */ } // all our XPMs are of this size static wxSize GetStdBmpSize() { return wxSize(8, 8); } wxBitmap GetIndicator(IndicatorType indType, int flags); virtual wxBitmap GetCheckBitmap(int flags) { return GetIndicator(IndicatorType_Check, flags); } virtual wxBitmap GetRadioBitmap(int flags) { return GetIndicator(IndicatorType_Radio, flags); } virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type); virtual int GetFrameBorderWidth(int flags) const;private: // the bitmaps returned by GetIndicator() wxBitmap m_bmpIndicators[IndicatorType_MaxCtrl] [IndicatorState_MaxCtrl] [IndicatorStatus_Max]; static const char **ms_xpmIndicators[IndicatorType_MaxCtrl] [IndicatorState_MaxCtrl] [IndicatorStatus_Max]; // the arrow bitmaps used by DrawArrow() wxBitmap m_bmpArrows[Arrow_Max]; static const char **ms_xpmArrows[Arrow_Max]; // the close bitmap for the frame for GetFrameButtonBitmap() wxBitmap m_bmpFrameClose; // pen used for foreground drawing wxPen m_penFg;};// ----------------------------------------------------------------------------// standard bitmaps// ----------------------------------------------------------------------------static const char *xpmUnchecked[] = {/* columns rows colors chars-per-pixel */"8 8 2 1"," c white","X c black",/* pixels */"XXXXXXXX","X X","X X","X X","X X","X X","X X","XXXXXXXX",};static const char *xpmChecked[] = {/* columns rows colors chars-per-pixel */"8 8 2 1"," c white","X c black",/* pixels */"XXXXXXXX","X X","X X X X","X XX X","X XX X","X X X X","X X","XXXXXXXX",};static const char *xpmUndeterminate[] = {/* columns rows colors chars-per-pixel */"8 8 2 1"," c white","X c black",/* pixels */"XXXXXXXX","X X X XX","XX X X X","X X X XX","XX X X X","X X X XX","XX X X X","XXXXXXXX",};static const char *xpmRadioUnchecked[] = {/* columns rows colors chars-per-pixel */"8 8 2 1"," c white","X c black",/* pixels */"XXXXXXXX","X X","X XX X","X X X X","X X X X","X XX X","X X","XXXXXXXX",};static const char *xpmRadioChecked[] = {/* columns rows colors chars-per-pixel */"8 8 2 1"," c white","X c black",/* pixels */"XXXXXXXX","X X","X XX X","X XXXX X","X XXXX X","X XX X","X X","XXXXXXXX",};const char **wxMonoRenderer::ms_xpmIndicators[IndicatorType_MaxCtrl] [IndicatorState_MaxCtrl] [IndicatorStatus_Max] ={ // checkboxes first { // normal state { xpmChecked, xpmUnchecked, xpmUndeterminate }, // pressed state { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate }, // disabled state { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate }, },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -