70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
#ifndef _TOOLBAR_HPP_
|
|
#define _TOOLBAR_HPP_
|
|
#include <mdiwin/window.hpp>
|
|
#include <mdiwin/string.hpp>
|
|
|
|
class Buttons
|
|
{
|
|
friend class ToolBar;
|
|
private:
|
|
RECT mRect;
|
|
HBITMAP mhBitmap;
|
|
UINT mMessage;
|
|
WPARAM mwParam;
|
|
LPARAM mlParam;
|
|
Buttons(){return;}
|
|
~Buttons(){return;}
|
|
};
|
|
|
|
class ToolBar : public Window
|
|
{
|
|
public:
|
|
ToolBar(HWND hParent,String caption);
|
|
virtual ~ToolBar();
|
|
void showWindow(int visible=TRUE);
|
|
WORD addBitmap(String bmpString,UINT Message,WPARAM wParam,LPARAM lParam);
|
|
WORD isVisible(void)const;
|
|
private:
|
|
enum {MaxCaption=50};
|
|
enum {WindowHeight=44,MaxButtons=25};
|
|
enum Position {UpperLeft,LastVisible};
|
|
void registerClass(void);
|
|
long WndProc(UINT message,WPARAM wParam,LPARAM lParam);
|
|
void handleDestroyEvent(void);
|
|
void Paint(void);
|
|
void Paint(WORD BitMap);
|
|
void LeftButtonUp();
|
|
void LeftButtonDown(WORD xPos,WORD yPos);
|
|
void mouseMove(WORD xPos,WORD yPos);
|
|
void setWidth(Position=UpperLeft);
|
|
void synchronizeToolBar(void);
|
|
DWORD isInButton(WORD xPos,WORD yPos)const;
|
|
|
|
static char szClassName[];
|
|
static char szMenuName[];
|
|
|
|
int mButtons;
|
|
POINT mLastOffset;
|
|
WORD mWindowWidth;
|
|
WORD mIsDestroyed;
|
|
DWORD mButtonDown;
|
|
HWND mhParent;
|
|
HINSTANCE mhInstance;
|
|
String mCaption;
|
|
Buttons mButton[MaxButtons];
|
|
};
|
|
|
|
inline
|
|
void ToolBar::handleDestroyEvent(void)
|
|
{
|
|
mIsDestroyed=TRUE;
|
|
}
|
|
|
|
inline
|
|
WORD ToolBar::isVisible(void)const
|
|
{
|
|
return ::IsWindowVisible(GetHandle());
|
|
}
|
|
#endif
|
|
|