2024-02-07 20:59:24 +08:00
|
|
|
#ifndef LUNA_BASE_WINDOW_H
|
|
|
|
#define LUNA_BASE_WINDOW_H
|
|
|
|
class control;
|
|
|
|
class basewindow{
|
|
|
|
public:
|
2024-02-09 09:25:26 +08:00
|
|
|
HFONT hfont=0;
|
2024-02-07 20:59:24 +08:00
|
|
|
HWND winId;
|
|
|
|
void setgeo(int,int,int,int);
|
|
|
|
RECT getgeo();
|
|
|
|
std::wstring text();
|
|
|
|
void settext(const std::wstring&);
|
2024-02-09 09:25:26 +08:00
|
|
|
void setfont(int,LPCWSTR fn=0);
|
2024-02-07 20:59:24 +08:00
|
|
|
operator HWND(){return winId;}
|
|
|
|
};
|
|
|
|
class mainwindow:public basewindow{
|
|
|
|
public:
|
|
|
|
std::vector<control*>controls;
|
|
|
|
mainwindow* parent;
|
|
|
|
HWND lastcontexthwnd;
|
|
|
|
virtual void on_show();
|
|
|
|
virtual void on_close();
|
|
|
|
virtual void on_size(int w,int h);
|
|
|
|
mainwindow(mainwindow* _parent=0);
|
|
|
|
LRESULT wndproc(UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
static void run();
|
|
|
|
void show();
|
|
|
|
void close();
|
2024-02-09 09:25:26 +08:00
|
|
|
void setcentral(int,int);
|
|
|
|
std::pair<int,int>calculateXY(int w,int h);
|
2024-02-07 20:59:24 +08:00
|
|
|
};
|
2024-02-11 23:49:11 +08:00
|
|
|
HICON GetExeIcon(const wchar_t* filePath);
|
2024-02-07 20:59:24 +08:00
|
|
|
#endif
|