aboutsummaryrefslogtreecommitdiff
path: root/Src/auth/Loginbox/loginPopup.h
diff options
context:
space:
mode:
authorJean-Francois Mauguit <jfmauguit@mac.com>2024-09-24 09:03:25 -0400
committerGitHub <noreply@github.com>2024-09-24 09:03:25 -0400
commitbab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/auth/Loginbox/loginPopup.h
parent4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff)
parent20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff)
downloadwinamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/auth/Loginbox/loginPopup.h')
-rw-r--r--Src/auth/Loginbox/loginPopup.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/Src/auth/Loginbox/loginPopup.h b/Src/auth/Loginbox/loginPopup.h
new file mode 100644
index 00000000..610b482f
--- /dev/null
+++ b/Src/auth/Loginbox/loginPopup.h
@@ -0,0 +1,100 @@
+#ifndef NULLSOFT_AUTH_LOGINPOPUP_HEADER
+#define NULLSOFT_AUTH_LOGINPOPUP_HEADER
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+#include <wtypes.h>
+
+// messages
+#define NLPOPUP_FIRST (WM_APP + 100)
+#define NLPOPUP_UPDATEWNDPOS (NLPOPUP_FIRST + 0) // wParam - (WPARAM)(const RECT*)clientRect, lParam = (LPARAM)(RECT*)popupRectOut; Return TRUE if you set controlRect;
+#define LoginPopup_UpdateWindowPos(/*HWND*/ __hwnd, /*const RECT* */__clientRect, /*RECT* */__popupRectOut)\
+ ((BOOL)SNDMSG((__hwnd), NLPOPUP_UPDATEWNDPOS, (WPARAM)(__clientRect), (LPARAM)(__popupRectOut)))
+
+#define NLPOPUP_PLAYBEEP (NLPOPUP_FIRST + 1) // wParam - not used, lParam - not used; Return ignored
+#define LoginPopup_PlayBeep(/*HWND*/ __hwnd)\
+ (SNDMSG((__hwnd), NLPOPUP_PLAYBEEP, 0, 0L))
+
+// notifications
+#define NLPOPUPN_FIRST (100)
+
+typedef struct __NLPNRESULT
+{
+ NMHDR hdr;
+ INT_PTR exitCode;
+} NLPNRESULT;
+
+#define NLPN_RESULT (NLPOPUPN_FIRST + 0)
+
+class __declspec(novtable) LoginPopup
+{
+public:
+ typedef HRESULT (CALLBACK *Creator)(HWND /*hwnd*/, LPARAM /*param*/, LoginPopup** /*instance*/);
+ typedef BOOL (CALLBACK *Enumerator)(HWND /*hwnd*/, LPARAM /*param*/);
+
+protected:
+ LoginPopup(HWND hwnd, UINT popupType, LPCWSTR pszTitle);
+ virtual ~LoginPopup();
+
+protected:
+ static HWND CreatePopup(LPCWSTR pszTemplate, HWND hParent, LPARAM param, Creator fnCreator);
+
+public:
+ static BOOL RegisterPopup(HWND hwnd, BOOL fRegister);
+ static BOOL EnumeratePopups(HWND hHost, Enumerator callback, LPARAM param);
+ static BOOL AnyPopup(HWND hHost);
+
+protected:
+ virtual void UpdateLayout(BOOL fRedraw);
+ virtual void Paint(HDC hdc, const RECT *prcPaint, BOOL fErase);
+ virtual void EndDialog(INT_PTR code);
+ virtual void UpdateMargins();
+ virtual void SetTitle(UINT type, LPCWSTR title);
+ virtual void SetAlert(UINT type, LPCWSTR message);
+ virtual void RemoveAlert();
+ virtual void UpdateTitle(BOOL playBeep);
+
+ BOOL GetInfoRect(RECT *rect);
+ BOOL CalculateWindowRect(LONG infoWidth, LONG infoHeight, const INT *buttonList, UINT buttonCount, BOOL includeTitle, RECT *rect);
+
+ HDWP LayoutButtons(HDWP hdwp, const INT *buttonList, UINT buttonCount, BOOL redraw, RECT *rectOut);
+ LRESULT SendNotification(UINT code, NMHDR *pnmh);
+ BOOL GetTextSize(HWND hText, LONG width, SIZE *size);
+
+protected:
+ virtual BOOL OnInitDialog(HWND hFocus, LPARAM param);
+ virtual void OnDestroy();
+ virtual void OnCommand(UINT commandId, UINT eventType, HWND hControl);
+ virtual LRESULT OnNotify(UINT controlId, const NMHDR *pnmh);
+ virtual HBRUSH OnGetStaticColor(HDC hdc, HWND hControl);
+ virtual void OnParentNotify(UINT eventId, UINT wParam, LPARAM lParam);
+
+ void OnPaint();
+ void OnWindowPosChanged(const WINDOWPOS *pwp);
+ void OnPrintClient(HDC hdc, UINT options);
+ void OnSetFont(HFONT font, BOOL redraw);
+
+ virtual BOOL OnUpdateWindowPos(const RECT* clientRect, RECT *rectOut);
+ virtual void OnPlayBeep();
+
+ virtual INT_PTR DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+private:
+ friend static INT_PTR CALLBACK LoginPopup_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ friend static LRESULT CALLBACK LoginPopup_MessageFilter(INT code, WPARAM wParam, LPARAM lParam);
+
+protected:
+ HWND hwnd;
+ SIZE idealSize;
+ RECT clientMargins;
+ RECT infoMargins;
+ LONG buttonHeight;
+ LONG buttonSpace;
+ UINT popupType;
+ UINT alertType;
+ LPWSTR alertMessage;
+};
+
+#endif //NULLSOFT_AUTH_LOGINPOPUP_HEADER \ No newline at end of file