📄 captionbar.h
字号:
/////////////////////////////////////////////////////////////////////////////// Name: captionbar.h// Purpose: wxFoldPanel// Author: Jorgen Bodde// Modified by: ABX - 19/12/2004 : possibility of horizontal orientation// : wxWidgets coding standards// Created: 22/06/2004// RCS-ID: $Id: captionbar.h,v 1.7 2005/07/28 23:23:22 VZ Exp $// Copyright: (c) Jorgen Bodde// Licence: wxWindows licence/////////////////////////////////////////////////////////////////////////////#ifndef __FOLDPANELBAR_H__#define __FOLDPANELBAR_H__#ifdef WXMAKINGDLL_FOLDBAR #define WXDLLIMPEXP_FOLDBAR WXEXPORT#elif defined(WXUSINGDLL) #define WXDLLIMPEXP_FOLDBAR WXIMPORT#else // not making nor using DLL #define WXDLLIMPEXP_FOLDBAR#endif#define wxFPB_EXTRA_X 10#define wxFPB_EXTRA_Y 4#define wxFPB_BMP_RIGHTSPACE 2 // pixels of the bmp to be aligned from the right filled with spaceenum{ /** Specifies the bars as gradient vertical filled caption bars going from top to bottom. The gradient starts with first colour, and ends with second colour */ wxCAPTIONBAR_GRADIENT_V = 1, /** Specifies the gradient going from left to right. The gradient starts with first colour, and ends with second colour on the right */ wxCAPTIONBAR_GRADIENT_H, /** Fills the captionbar with a single colour. The first colour is used for this fill */ wxCAPTIONBAR_SINGLE, /** Draws a rectangle only using the second colour. The first colour is not used*/ wxCAPTIONBAR_RECTANGLE, /** Fills the captionbar with a single colour (first colour) and draws a rectangle around it using the second colour. */ wxCAPTIONBAR_FILLED_RECTANGLE};/** \class wxCaptionBarStyle This class encapsulates the styles you wish to set for the wxCaptionBar (this is the part of the wxFoldPanel where the caption is displayed). It can either be applied at creation time be reapplied when styles need to be changed. At construction time, all styles are set to their default transparency. This means none of the styles will be applied to the wxCaptionBar in question, meaning it will be created using the default internals. When setting i.e the color, font or panel style, these styles become active to be used.*/class WXDLLIMPEXP_FOLDBAR wxCaptionBarStyle{private: // boolean flags for default transparency on styles bool m_firstColourUsed, m_secondColourUsed, m_textColourUsed, m_captionFontUsed, m_captionStyleUsed; wxFont m_captionFont; wxColour m_firstColour, m_secondColour, m_textColour; int m_captionStyle;public: /** Default constructor for this class */ wxCaptionBarStyle() { ResetDefaults(); }; ~wxCaptionBarStyle() { }; void ResetDefaults() { m_firstColourUsed = false; m_secondColourUsed = false; m_textColourUsed = false; m_captionFontUsed = false; m_captionStyleUsed = false; m_captionStyle = wxCAPTIONBAR_GRADIENT_V; }; /** Copy operator. Only the styles in use in the source object are being copied to the destination object. All other styles are not copied */ void operator=(const wxCaptionBarStyle &s) { if(s.m_captionStyleUsed) { m_captionStyleUsed = true; m_captionStyle = s.m_captionStyle; } if(s.m_captionFontUsed) { m_captionFontUsed = true; m_captionFont = s.m_captionFont; } if(s.m_firstColourUsed) { m_firstColourUsed = true; m_firstColour = s.m_firstColour; } if(s.m_secondColourUsed) { m_secondColourUsed = true; m_secondColour = s.m_secondColour; } if(s.m_textColourUsed) { m_textColourUsed = true; m_textColour = s.m_textColour; } }; // ------- CaptionBar Font ------- /** Set font for the caption bar. If this is not set, the font property is undefined and will not be used. Use CaptionFontUsed() to check if this style is used */ void SetCaptionFont(const wxFont &font) { m_captionFont = font; m_captionFontUsed = true; }; /** Checks if the caption bar font is set */ bool CaptionFontUsed() const { return m_captionFontUsed; }; /** Returns the font for the caption bar. Please be warned this will result in an assertion failure when this property is not previously set \sa SetCaptionFont(), CaptionFontUsed() */ wxFont GetCaptionFont() const { wxASSERT(m_captionFontUsed); return m_captionFont; }; // ------- FirstColour ------- /** Set first colour for the caption bar. If this is not set, the colour property is undefined and will not be used. Use FirstColourUsed() to check if this style is used */ void SetFirstColour(const wxColour &col) { m_firstColour = col; m_firstColourUsed = true; }; /** Checks if the first colour of the caption bar is set */ bool FirstColourUsed() const { return m_firstColourUsed; }; /** Returns the first colour for the caption bar. Please be warned this will result in an assertion failure when this property is not previously set. \sa SetCaptionFirstColour(), CaptionFirstColourUsed() */ wxColour GetFirstColour() const { wxASSERT(m_firstColourUsed); return m_firstColour; }; // ------- SecondColour ------- /** Set second colour for the caption bar. If this is not set, the colour property is undefined and will not be used. Use SecondColourUsed() to check if this style is used */ void SetSecondColour(const wxColour &col) { m_secondColour = col; m_secondColourUsed = true; }; /** Checks if the second colour of the caption bar is set */ bool SecondColourUsed() const { return m_secondColourUsed; }; /** Returns the second colour for the caption bar. Please be warned this will result in an assertion failure when this property is not previously set. \sa SetSecondColour(), SecondColourUsed() */ wxColour GetSecondColour() const { wxASSERT(m_secondColourUsed); return m_secondColour; }; // ------- Caption Text Colour ------- /** Set caption colour for the caption bar. If this is not set, the colour property is undefined and will not be used. Use CaptionColourUsed() to check if this style is used */ void SetCaptionColour(const wxColour &col) { m_textColour = col; m_textColourUsed = true; }; /** Checks if the caption colour of the caption bar is set */ bool CaptionColourUsed() const { return m_textColourUsed; }; /** Returns the caption colour for the caption bar. Please be warned this will result in an assertion failure when this property is not previously set. \sa SetCaptionColour(), CaptionColourUsed() */ wxColour GetCaptionColour() const { wxASSERT(m_textColourUsed); return m_textColour; }; // ------- CaptionStyle ------- /** Set caption style for the caption bar. If this is not set, the property is undefined and will not be used. Use CaptionStyleUsed() to check if this style is used. The following styles can be applied: - wxCAPTIONBAR_GRADIENT_V: Draws a vertical gradient from top to bottom - wxCAPTIONBAR_GRADIENT_H: Draws a horizontal gradient from left to right - wxCAPTIONBAR_SINGLE: Draws a single filled rectangle to draw the caption - wxCAPTIONBAR_RECTANGLE: Draws a single colour with a rectangle around the caption - wxCAPTIONBAR_FILLED_RECTANGLE: Draws a filled rectangle and a border around it */ void SetCaptionStyle(int style) { m_captionStyle = style; m_captionStyleUsed = true; }; /** Checks if the caption style of the caption bar is set */ bool CaptionStyleUsed() const { return m_captionStyleUsed; }; /** Returns the caption style for the caption bar. Please be warned this will result in an assertion failure when this property is not previously set. \sa SetCaptionStyle(), CaptionStyleUsed() */ int GetCaptionStyle() const { wxASSERT(m_captionStyleUsed); return m_captionStyle; };};#ifndef _NO_CAPTIONBAR_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -