📄 window.h
字号:
/**
* Window类用于创建一个用来绘图的简单窗口,用来加载Panel,完成消息映射。
*/
#pragma once
typedef struct
{
unsigned long flag;
Panel *pChanger;
}RefreshParam;
enum
{
METHOD_DETECT = 0x0001,
METHOD_REFRESH = 0x0002,
METHOD_MASK = 0x00FF,
REFRESH_NONE = 0x0000,
REFRESH_UPPER = 0x0100,
REFRESH_ALL = 0x0200,
REFRESH_MASK = 0xFF00
};
class Window
{
public:
Window(bool isMainWindow = true);
virtual ~Window(void);
int create(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPCWSTR caption = L"Window");
int show(int width, int height); // Show the window with certain client size
int run(void);
void destroy(void);
void addDrawTrigger(Trigger *pTrigger);
void addEventTrigger(EventTrigger *pEventTrigger);
void refresh(void);
HWND gethWnd(void);
HDC gethMemDC(void);
void getSize(int &width, int &height);
protected:
void onRefresh(void); // Called in TimerProc
void onPaint(void); // Called in WM_PAINT
LRESULT WINAPI onKBEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT WINAPI onMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT WINAPI WndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static VOID CALLBACK TimerProc(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
protected:
HWND mhWnd;
HDC mhMemDC;
HBITMAP mhMemBMP, mhMemBMPOld;
bool mIsMainWindow;
int mWidth, mHeight;
static bool sMainWindowExists;
Trigger mDT;
EventTrigger mET;
public:
friend class Scene;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -