Initial Commit
This commit is contained in:
153
common/Progress.hpp
Normal file
153
common/Progress.hpp
Normal file
@@ -0,0 +1,153 @@
|
||||
#if defined(__FLAT__)
|
||||
#ifndef _COMMON_PROGRESS_HPP_
|
||||
#define _COMMON_PROGRESS_HPP_
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_FONT_HPP_
|
||||
#include <common/font.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_COMMCTRL_HPP_
|
||||
#include <common/commctrl.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_ICONFRAME_HPP_
|
||||
#include <common/iconfrm.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_MMTIMER_HPP_
|
||||
#include <common/mmtimer.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_WINDOW_HPP_
|
||||
#include <common/window.hpp>
|
||||
#endif
|
||||
|
||||
class Progress : public Window, private MMTimer
|
||||
{
|
||||
public:
|
||||
Progress(GUIWindow &parentWindow);
|
||||
Progress(GUIWindow &parentWindow,String captionString);
|
||||
Progress(GUIWindow &parentWindow,String captionString,Block<String> &iconNames);
|
||||
virtual ~Progress();
|
||||
WORD operator++(void);
|
||||
WORD operator++(int postFixDummy);
|
||||
WORD operator+=(const String &messageString);
|
||||
WORD setPosition(DWORD position);
|
||||
WORD setText(const String &messageString);
|
||||
WORD getText(String &messageString);
|
||||
WORD setCaption(const String &captionString);
|
||||
WORD range(DWORD itemCount);
|
||||
DWORD itemIndex(void)const;
|
||||
WORD reset(void);
|
||||
void show(WORD onOff);
|
||||
WORD canCancel(void)const;
|
||||
void canCancel(WORD canCancel);
|
||||
WORD isOkay(void)const;
|
||||
private:
|
||||
enum{ProgressBarID=0x10,StaticTextID=0x11};
|
||||
enum{bkRed=192,bkGreen=192,bkBlue=192};
|
||||
enum{PWcx=280,PWcy=100};
|
||||
enum{PCx=5,PCy=40,PCcx=265,PCcy=15};
|
||||
enum{SCx=5,SCy=60,SCcx=265,SCcy=18};
|
||||
enum{FullRange=100,EscapeKey=27};
|
||||
enum MsgType{SetRange=PBM_SETRANGE,SetPos=PBM_SETPOS,DeltaPos=PBM_DELTAPOS,SetStep=PBM_SETSTEP,StepIt=PBM_STEPIT};
|
||||
Progress(const Progress &someProgress);
|
||||
Progress &operator=(const Progress &someProgress);
|
||||
void progressMessage(MsgType msgType,WPARAM wParam,LPARAM lParam=0L);
|
||||
void staticMessage(const String &messageString);
|
||||
void registerClass(void);
|
||||
void createWindow(void);
|
||||
void createControls(void);
|
||||
void destroyControls(void);
|
||||
void insertHandlers(void);
|
||||
void removeHandlers(void);
|
||||
void initialPoint(const GUIWindow &parentWindow);
|
||||
void insertIcons(Block<String> &iconNames);
|
||||
void shutdown(void);
|
||||
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType controlColorHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType timerHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType charHandler(CallbackData &someCallbackData);
|
||||
|
||||
static char szClassName[];
|
||||
static char szFontName[];
|
||||
Callback<Progress> mControlColorHandler;
|
||||
Callback<Progress> mPaintHandler;
|
||||
Callback<Progress> mCreateHandler;
|
||||
Callback<Progress> mTimerHandler;
|
||||
Callback<Progress> mCharHandler;
|
||||
HWND mhParentWindow;
|
||||
HINSTANCE mhProcessInstance;
|
||||
Point mInitialPoint;
|
||||
String mClassName;
|
||||
String mCaptionString;
|
||||
HWND mhProgressControl;
|
||||
HWND mhStaticControl;
|
||||
HBRUSH mhBrush;
|
||||
Font mFont;
|
||||
DWORD mItemIndex;
|
||||
DWORD mItemCount;
|
||||
WORD mCanCancel;
|
||||
IconFrame mIconFrame;
|
||||
};
|
||||
|
||||
inline
|
||||
Progress::Progress(const Progress &/*someProgress*/)
|
||||
{ // no implementation
|
||||
}
|
||||
|
||||
inline
|
||||
Progress &Progress::operator=(const Progress &/*someProgress*/)
|
||||
{ // no implementation
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Progress::operator++(int /*postFixDummy*/)
|
||||
{
|
||||
return ++(*this);
|
||||
}
|
||||
|
||||
inline
|
||||
void Progress::progressMessage(MsgType msgType,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
::SendMessage(mhProgressControl,msgType,wParam,lParam);
|
||||
}
|
||||
|
||||
inline
|
||||
void Progress::staticMessage(const String &messageString)
|
||||
{
|
||||
sendMessage(mhStaticControl,WM_SETTEXT,0,(LONG)(LPSTR)messageString);
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Progress::setCaption(const String &captionString)
|
||||
{
|
||||
return sendMessage(*this,WM_SETTEXT,0,(LONG)(LPSTR)captionString);
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD Progress::itemIndex(void)const
|
||||
{
|
||||
return mItemIndex;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Progress::canCancel(void)const
|
||||
{
|
||||
return mCanCancel;
|
||||
}
|
||||
|
||||
inline
|
||||
void Progress::canCancel(WORD canCancel)
|
||||
{
|
||||
mCanCancel=canCancel;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Progress::isOkay(void)const
|
||||
{
|
||||
return ((HWND)*this&&mhProgressControl&&mhStaticControl);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user