LunaHook-mirror/LunaHost/GUI/window.h

37 lines
993 B
C
Raw Normal View History

2024-02-07 20:59:24 +08:00
#ifndef LUNA_BASE_WINDOW_H
#define LUNA_BASE_WINDOW_H
class control;
class basewindow{
public:
HWND winId;
2024-03-28 11:01:44 +08:00
virtual void setgeo(int,int,int,int);
virtual void on_size(int w,int h);
2024-02-07 20:59:24 +08:00
RECT getgeo();
std::wstring text();
void settext(const std::wstring&);
operator HWND(){return winId;}
};
class mainwindow:public basewindow{
2024-04-25 15:44:28 +08:00
HFONT hfont=0;
2024-02-07 20:59:24 +08:00
public:
2024-04-25 15:44:28 +08:00
void setfont(int,LPCWSTR fn=0);
void visfont();
2024-02-07 20:59:24 +08:00
std::vector<control*>controls;
2024-04-25 15:44:28 +08:00
std::vector<mainwindow*>childrens;
2024-02-07 20:59:24 +08:00
mainwindow* parent;
HWND lastcontexthwnd;
2024-03-28 11:01:44 +08:00
control* layout;
2024-02-07 20:59:24 +08:00
virtual void on_show();
virtual void on_close();
2024-03-28 11:01:44 +08:00
void on_size(int w,int h);
2024-02-07 20:59:24 +08:00
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-03-28 11:01:44 +08:00
void setlayout(control*);
2024-02-07 20:59:24 +08:00
};
2024-02-12 00:17:58 +08:00
HICON GetExeIcon(const std::wstring& filePath);
2024-02-07 20:59:24 +08:00
#endif