【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-XSTATUSBAR.CPP的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
/*****************************************************************************
*
* Autor: Joachim Raidl
* Adresse: Joachim.Raidl@iname.com
* Klasse: XPaneInfo, XStatusBar
* Files: XStatusBar.Cpp, XStatusBar.H
* Beschreibung: Mit dieser Klasse k鰊nen komplexe Status-Zeilen verwaltet
* werden. So k鰊nen in jedem Pane Texte, Bitmaps oder
* Progress-Bars dargestellt, horizontal, vertikal oder
* diagonal gescrollt und links, rechts oder zentriert
* ausgerichtet werden. Auch kann jeder Zeit zwischen den
* einzelnen Modi hin- und hergeschaltet werden. F黵 jede
* Pane kann sowohl ein Einschalt- als auch ein Ausschalt-
* text, -hintergrund oder -bitmap definiert werden.
* Funktionen: operator=(), SetDefault(), SetFont(), SetMode(),
* (XPaneInfo) SetFgColor(), SetBkColor(), SetBitmap(), SetText(),
* SetNumber(), HScroll(), VScroll(),
* Funktionen: CreateStatusBar(), SetIndicators(), OnPaint(),
* (XStatusBar) DrawSizing(), DrawTextPane(), DrawBitmapPane(),
* DrawProgressPane(), GetXPaneInfo(), OnTimer(),
* SetStyle(), SetWidth(), GetStyle(), GetWidth(), GetID(),
* OnDestroy(), SavePane(), RestorePane(),
* GetPaneAtPosition(), OnMouseMove(),
* OnLButtonUp(), OnMButtonUp(), OnRButtonUp(),
* OnLButtonDown(), OnMButtonDown(), OnRButtonDown(),
* OnLButtonDblClk(), OnMButtonDblClk(), OnRButtonDblClk(),
*
****************************************************************************/
#include "StdAfx.h"
#include "XStatusBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
volatile static char jrrcid[] = "%J%";
#define IDC_JRLIB_STATUSBAR_TIMER 20000
/*****************************************************************************
* Klasse: XPaneInfo
* Funktion: XPaneInfo, ~XPaneInfo
* Parameter: -
* Return:
*
* Der Konstruktor initialisiert ein Pane. Im Desturktor wird eine eventuell
* vorhandene Progress-Kontrolle wieder gel鰏cht.
****************************************************************************/
XPaneInfo::XPaneInfo()
{
progress = NULL;
hScrollPos = 0;
vScrollPos = 0;
SetDefault();
}
XPaneInfo::XPaneInfo(const XPaneInfo& paneInfo)
{
for (int i = 0; i < 2; i++)
{
fgColor[i] = paneInfo.fgColor[i];
bkColor[i] = paneInfo.bkColor[i];
string[i] = paneInfo.string[i];
}
font = paneInfo.font;
mode = paneInfo.mode;
progress = NULL;
hScrollPos = paneInfo.hScrollPos;
vScrollPos = paneInfo.vScrollPos;
}
XPaneInfo::~XPaneInfo()
{
if (progress) delete progress;
progress = NULL;
}
/*****************************************************************************
* Klasse: XPaneInfo
* Funktion: operator=
* Parameter: paneInfo Zweites XPaneInfo-Element, dessen Informationen
* kopiert werden.
* Return: Kopie des XPaneInfo-Elements
*
* Zuweisungsoperator.
* !!! ACHTUNG !!! 'progress' wird nicht kopiert! Ein eventuell vorhandener
* Progress-Bar wird gel鰏cht.
****************************************************************************/
XPaneInfo XPaneInfo::operator=(const XPaneInfo& paneInfo)
{
for (int i = 0; i < 2; i++)
{
fgColor[i] = paneInfo.fgColor[i];
bkColor[i] = paneInfo.bkColor[i];
string[i] = paneInfo.string[i];
}
font = paneInfo.font;
mode = paneInfo.mode;
hScrollPos = paneInfo.hScrollPos;
vScrollPos = paneInfo.vScrollPos;
if (progress) delete progress;
progress = NULL;
return *this;
}
/*****************************************************************************
* Klasse: XPaneInfo
* Funktion: SetDefault
* Parameter: -
* Return: -
*
* Hier werden die Members initialisiert.
****************************************************************************/
void XPaneInfo::SetDefault()
{
bkColor[1] = COLORREF(GetSysColor(COLOR_MENU));
bkColor[0] = bkColor[1];
fgColor[1] = GetSysColor(COLOR_MENUTEXT);
fgColor[0] = RGB(GetRValue(bkColor[1])/2, GetGValue(bkColor[1])/2, GetBValue(bkColor[1])/2);
mode = XSB_TEXT | DT_LEFT;
SetFont(CFont::FromHandle((HFONT) GetStockObject(ANSI_VAR_FONT)));
if (progress) delete progress;
progress = NULL;
}
/****************************************************************************