⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wg_groupbox.cpp

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 CPP
字号:
// wg_groupbox.cpp//// CGroupBox class implementation////// Copyright (c) 2002 Rob Wiskow// rob-dev@boxedchaos.com//// This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.//// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//#include "wgui_include_config.h"#include "wg_groupbox.h"namespace wGui{CGroupBox::CGroupBox(const CRect& WindowRect, CWindow* pParent, std::string sText, CRGBColor& FontColor, CFontEngine* pFontEngine) :	CWindow(WindowRect, pParent),	m_FontColor(FontColor){  m_sClassName = "CGroupBox";	m_sWindowText = sText;	if (pFontEngine)	{		m_pFontEngine = pFontEngine;	}	else	{		m_pFontEngine = CApplication::Instance()->GetDefaultFontEngine();	}	m_ClientRect.Grow(-2);	m_ClientRect.SetTop(15);	std::auto_ptr<CRenderedString> pRenderedString(new CRenderedString(		m_pFontEngine, sText, CRenderedString::VALIGN_TOP, CRenderedString::HALIGN_LEFT));	m_pRenderedString = pRenderedString;	m_BGColor = DEFAULT_BG_COLOR;}CGroupBox::~CGroupBox(void){}void CGroupBox::Draw(void) const{	CWindow::Draw();	CPainter Painter(m_pSDLSurface);	Painter.DrawRect(CRect(m_WindowRect.Left(), m_WindowRect.Top() + 5, m_WindowRect.Right(), m_WindowRect.Bottom()),		false, DEFAULT_LINE_COLOR);	CPoint Dims, Offset;	m_pRenderedString->GetMetrics(&Dims, &Offset, 0);	Painter.DrawRect(CRect(m_WindowRect.TopLeft() + CPoint(6, 0), m_WindowRect.TopLeft() + CPoint(14, 0) + Dims),		true, DEFAULT_BG_COLOR, DEFAULT_BG_COLOR);	m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect, m_WindowRect.TopLeft() + CPoint(10, 0), m_FontColor);}void CGroupBox::SetWindowText(const std::string& sWindowText){	CWindow::SetWindowText(sWindowText);	std::auto_ptr<CRenderedString> pRenderedString(new CRenderedString(		m_pFontEngine, sWindowText, CRenderedString::VALIGN_TOP, CRenderedString::HALIGN_LEFT));	m_pRenderedString = pRenderedString;	StartDrawProc();}void CGroupBox::SetWindowRect(const CRect& WindowRect){	CWindow::SetWindowRect(WindowRect);	m_ClientRect = m_WindowRect;	m_ClientRect.Grow(-2);	m_ClientRect.SetTop(15);}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -