diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-02 20:16:04 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-02 20:16:18 +0200 |
commit | bc4cef92d8efbf97a9215122abc2d7247c287f12 (patch) | |
tree | a5ca307281c4f143b5f172428c9fd2b629d6b426 /c/window.h | |
parent | 5c1c2ce2bdbf9735ad8a4d162609a8c22a4f0954 (diff) | |
download | EpisodeBrowser-bc4cef92d8efbf97a9215122abc2d7247c287f12.tar.gz |
Improve Window object.
Diffstat (limited to 'c/window.h')
-rw-r--r-- | c/window.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/c/window.h b/c/window.h new file mode 100644 index 0000000..5cdffe4 --- /dev/null +++ b/c/window.h @@ -0,0 +1,50 @@ +#ifndef WINDOW_H +#define WINDOW_H + +#include <windows.h> + +#include "data.h" +#include "datalistview.h" +#include "drag.h" +#include "episodelistview.h" +#include "resource.h" +#include "win32.h" + +struct Window +{ + HWND hWnd; + HWND hWndFocus = nullptr; + HWND hWndStatus = nullptr; + HMENU hMenuPopup = Require(GetSubMenu(Require(LoadMenuW(nullptr, MAKEINTRESOURCE(IDR_POPUPMENU))), 0)); + + /* File views. */ + FileView<CfgA> fvCfg = FileView<CfgA>::Initialized(L"cfg.dat", 1); + CfgA& cfg = fvCfg.At(0); + FileView<ElvDataA> fvElv{L"elvdata.dat", cfg.cEp+128u}; + FileView<DlvDataA> fvDlv{L"dlvdata.dat", cfg.cEp+128u}; + + /* Layout handlers. */ + DlvDragger dragDlv = DlvDragger(*this); + + /* Child window objects. */ + DataListView dlv = DataListView(*this); + EpisodeListView elv = EpisodeListView(*this); + + inline Window(HWND hWnd) : hWnd(hWnd) {} + LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); + + /* Given main window's width and height, set appropriate + * positions and sizes for child windows. */ + void UpdateLayout(int w = 0, int h = 0); + + /* Process main menu commands. */ + void HandleMainMenu(HWND, WORD); + + /* Display text in status bar. */ + void Status(const wchar_t* msg, unsigned short i = 0); + + /* Try to style application according to current Windows theme. */ + void UpdateTheme(); +}; + +#endif |