📄 renderer.h
字号:
///////////////////////////////////////////////////////////////////////////////
// Name: wx/univ/renderer.h
// Purpose: wxRenderer class declaration
// Author: Vadim Zeitlin
// Modified by:
// Created: 06.08.00
// RCS-ID: $Id: renderer.h,v 1.1 2005/03/16 06:50:11 kehc Exp $
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////////
/*
wxRenderer class is used to draw all wxWindows controls. This is an ABC and
the look of the application is determined by the concrete derivation of
wxRenderer used in the program.
It also contains a few static methods which may be used by the concrete
renderers and provide the functionality which is often similar or identical
in all renderers (using inheritance here would be more restrictive as the
given concrete renderer may need an arbitrary subset of the base class
methods)
*/
#ifdef __GNUG__
#pragma interface "renderer.h"
#endif
#ifndef _WX_UNIV_RENDERER_H_
#define _WX_UNIV_RENDERER_H_
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxCheckListBox;
class WXDLLEXPORT wxListBox;
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxMenuGeometryInfo;
class WXDLLEXPORT wxScrollBar;
class WXDLLEXPORT wxTextCtrl;
class WXDLLEXPORT wxWindow;
#if wxUSE_GAUGE
class WXDLLEXPORT wxGauge;
#endif // wxUSE_GAUGE
#include "wx/string.h"
#include "wx/gdicmn.h"
#include "wx/icon.h"
#include "wx/scrolbar.h" // for wxScrollBar::Element
// helper class used by wxMenu-related functions
class WXDLLEXPORT wxMenuGeometryInfo
{
public:
// get the total size of the menu
virtual wxSize GetSize() const = 0;
virtual ~wxMenuGeometryInfo();
};
// ----------------------------------------------------------------------------
// wxRenderer: abstract renderers interface
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxRenderer
{
public:
// drawing functions
// -----------------
// draw the controls background
virtual void DrawBackground(wxDC& dc,
const wxColour& col,
const wxRect& rect,
int flags,
wxWindow *window = NULL ) = 0;
// draw the button surface
virtual void DrawButtonSurface(wxDC& dc,
const wxColour& col,
const wxRect& rect,
int flags )
{ DrawBackground( dc, col, rect, flags ); }
// draw the label inside the given rectangle with the specified alignment
// and optionally emphasize the character with the given index
virtual void DrawLabel(wxDC& dc,
const wxString& label,
const wxRect& rect,
int flags = 0,
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
int indexAccel = -1,
wxRect *rectBounds = NULL) = 0;
// same but also draw a bitmap if it is valid
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) = 0;
// draw the border and optionally return the rectangle containing the
// region inside the border
virtual void DrawBorder(wxDC& dc,
wxBorder border,
const wxRect& rect,
int flags = 0,
wxRect *rectIn = (wxRect *)NULL) = 0;
// draw text control border (I hate to have a separate method for this but
// it is needed to accomodate GTK+)
virtual void DrawTextBorder(wxDC& dc,
wxBorder border,
const wxRect& rect,
int flags = 0,
wxRect *rectIn = (wxRect *)NULL) = 0;
// draw push button border and return the rectangle left for the label
virtual void DrawButtonBorder(wxDC& dc,
const wxRect& rect,
int flags = 0,
wxRect *rectIn = (wxRect *)NULL) = 0;
// draw a horizontal line
virtual void DrawHorizontalLine(wxDC& dc,
wxCoord y, wxCoord x1, wxCoord x2) = 0;
// draw a vertical line
virtual void DrawVerticalLine(wxDC& dc,
wxCoord x, wxCoord y1, wxCoord y2) = 0;
// draw a frame with the label (horizontal alignment can be specified)
virtual void DrawFrame(wxDC& dc,
const wxString& label,
const wxRect& rect,
int flags = 0,
int alignment = wxALIGN_LEFT,
int indexAccel = -1) = 0;
// draw an arrow in the given direction
virtual void DrawArrow(wxDC& dc,
wxDirection dir,
const wxRect& rect,
int flags = 0) = 0;
// draw a scrollbar arrow (may be the same as arrow but may be not)
virtual void DrawScrollbarArrow(wxDC& dc,
wxDirection dir,
const wxRect& rect,
int flags = 0) = 0;
// draw the scrollbar thumb
virtual void DrawScrollbarThumb(wxDC& dc,
wxOrientation orient,
const wxRect& rect,
int flags = 0) = 0;
// draw a (part of) scrollbar shaft
virtual void DrawScrollbarShaft(wxDC& dc,
wxOrientation orient,
const wxRect& rect,
int flags = 0) = 0;
// draw the rectangle in the corner between two scrollbars
virtual void DrawScrollCorner(wxDC& dc,
const wxRect& rect) = 0;
// draw an item of a wxListBox
virtual void DrawItem(wxDC& dc,
const wxString& label,
const wxRect& rect,
int flags = 0) = 0;
// draw an item of a wxCheckListBox
virtual void DrawCheckItem(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
const wxRect& rect,
int flags = 0) = 0;
// draw a checkbutton (bitmap may be invalid to use default one)
virtual void DrawCheckButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
const wxRect& rect,
int flags = 0,
wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1) = 0;
// draw a radio button
virtual void DrawRadioButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
const wxRect& rect,
int flags = 0,
wxAlignment align = wxALIGN_LEFT,
int indexAccel = -1) = 0;
// 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,
const wxString& label,
const wxBitmap& bitmap,
const wxRect& rect,
int flags = 0) = 0;
// draw a (part of) line in the text control
virtual void DrawTextLine(wxDC& dc,
const wxString& text,
const wxRect& rect,
int selStart = -1,
int selEnd = -1,
int flags = 0) = 0;
// draw a line wrap indicator
virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) = 0;
// draw a notebook tab
virtual void DrawTab(wxDC& dc,
const wxRect& rect,
wxDirection dir,
const wxString& label,
const wxBitmap& bitmap = wxNullBitmap,
int flags = 0,
int indexAccel = -1) = 0;
// draw the slider shaft
virtual void DrawSliderShaft(wxDC& dc,
const wxRect& rect,
wxOrientation orient,
int flags = 0,
wxRect *rectShaft = NULL) = 0;
// draw the slider thumb
virtual void DrawSliderThumb(wxDC& dc,
const wxRect& rect,
wxOrientation orient,
int flags = 0) = 0;
// draw the slider ticks
virtual void DrawSliderTicks(wxDC& dc,
const wxRect& rect,
const wxSize& sizeThumb,
wxOrientation orient,
int start,
int end,
int step = 1,
int flags = 0) = 0;
// draw a menu bar item
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
const wxString& label,
int flags = 0,
int indexAccel = -1) = 0;
// draw a menu item (also used for submenus if flags has ISSUBMENU flag)
//
// the geometryInfo is calculated by GetMenuGeometry() function from below
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) = 0;
// draw a menu bar separator
virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y,
const wxMenuGeometryInfo& geomInfo) = 0;
// 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) = 0;
// draw complete frame/dialog titlebar
virtual void DrawFrameTitleBar(wxDC& dc,
const wxRect& rect,
const wxString& title,
const wxIcon& icon,
int flags,
int specialButton = 0,
int specialButtonFlags = 0) = 0;
// draw frame borders
virtual void DrawFrameBorder(wxDC& dc,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -