aboutsummaryrefslogtreecommitdiff
path: root/c/defs.h
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-10 23:23:09 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-10 23:25:09 +0200
commit295d423cc47f9ee8a72134dc544892a03b279311 (patch)
tree3e89b0bbcf42b3053225eb0dff88b887dd16df48 /c/defs.h
parent85a4ad2c184ed915915a2fb630415a80ed9a286f (diff)
downloadEpisodeBrowser-295d423cc47f9ee8a72134dc544892a03b279311.tar.gz
Convert to C++.
I already hit upon some object-oriented programming patterns in *listview.c, so I felt that it would be natural to use this as an opportunity to learn C++.
Diffstat (limited to 'c/defs.h')
-rw-r--r--c/defs.h71
1 files changed, 43 insertions, 28 deletions
diff --git a/c/defs.h b/c/defs.h
index 8196a93..9f53c92 100644
--- a/c/defs.h
+++ b/c/defs.h
@@ -5,36 +5,51 @@
#include <commctrl.h>
#include <SWI-Prolog.h>
-/* common.c */
+/* common.cpp */
TCHAR *TszFromSz(const char *, int);
-/* main.c */
+/* main.cpp */
void UpdateLayout();
-/* listview.c */
-HWND LvCreate(HMENU, DWORD);
-int LvHeight(HWND, int);
-
-/* episodelistview.c */
-HWND ElvCreate();
-void ElvDoSort(void);
-LRESULT ElvHandleNotify(LPARAM);
-void ElvRedraw(void);
-void ElvSetTop(int);
-void ElvSelectFocus(void);
-void ElvSelectUnwatched(int);
-void ElvShowFocus(void);
-void ElvUpdate(void);
-void ElvUpdateItem(LPLVITEM);
-
-/* datalistview.c */
-HWND DlvCreate();
-void DlvShowEpisode(int);
-
-/* pl.c */
-int Pl(char *, char *, char *, ...);
-int Plp(term_t, char *, ...);
-int Plg(term_t, char *, ...);
+/* listview.cpp */
+class ListView {
+protected:
+ WNDPROC m_prevProc;
+ HWND m_hWnd;
+public:
+ void Create(HMENU, DWORD);
+ int Height(int);
+ HWND HWnd(void);
+ virtual LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+};
+
+/* episodelistview.cpp */
+class EpisodeListView: public ListView {
+public:
+ void Create(void);
+ void DoSort(void);
+ LRESULT HandleNotify(LPARAM);
+ void Redraw(void);
+ void SetTop(int);
+ void SelectFocus(void);
+ void SelectUnwatched(int);
+ void ShowFocus(void);
+ void Update(void);
+ void UpdateItem(LPLVITEM);
+ LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+};
+
+/* datalistview.cpp */
+class DataListView: public ListView {
+public:
+ void Create(void);
+ void ShowEpisode(int);
+};
+
+/* pl.cpp */
+int Pl(const char *, const char *, const char *, ...);
+int Plp(term_t, const char *, ...);
+int Plg(term_t, const char *, ...);
/* defs.h */
#define DLVSIKEY 0
@@ -56,8 +71,8 @@ Cmp(int a, int b)
inline int
Dpi(int i)
{
- extern int IDPI;
- return MulDiv(i, IDPI, 96);
+ extern int g_iDPI;
+ return MulDiv(i, g_iDPI, 96);
}
#endif