diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-09 21:26:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-09 21:30:54 +0300 |
commit | 856ff580fd9d776c331a6b525fa7d73a24d92f64 (patch) | |
tree | 42c4912b0b9c406c15783af3fc6e8c4857b09de1 /plugins/SeenPlugin/src | |
parent | 68c2dea66f3e368cc1437f7890c8e62907890fcd (diff) |
UserInfo -> UI classes
Diffstat (limited to 'plugins/SeenPlugin/src')
-rw-r--r-- | plugins/SeenPlugin/src/stdafx.h | 1 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/userinfo.cpp | 56 |
2 files changed, 27 insertions, 30 deletions
diff --git a/plugins/SeenPlugin/src/stdafx.h b/plugins/SeenPlugin/src/stdafx.h index c636358661..9172cce71d 100644 --- a/plugins/SeenPlugin/src/stdafx.h +++ b/plugins/SeenPlugin/src/stdafx.h @@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_skin.h>
#include <m_userinfo.h>
#include <m_icolib.h>
+#include <m_options.h>
#include <m_clistint.h>
#include <m_contacts.h>
#include <m_message.h>
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 2f2966d25a..1a323a5e11 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-LRESULT CALLBACK EditProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+static LRESULT CALLBACK EditProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch (msg) {
case WM_SETCURSOR:
@@ -30,47 +30,43 @@ LRESULT CALLBACK EditProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) return mir_callNextSubclass(hdlg, EditProc, msg, wparam, lparam);
}
-INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+struct UserinfoDlg : public CUserInfoPageDlg
{
- switch (msg) {
- case WM_INITDIALOG:
- mir_subclassWindow(GetDlgItem(hdlg, IDC_INFOTEXT), EditProc);
- WindowList_Add(g_pUserInfo, hdlg, lparam);
- SendMessage(hdlg, WM_REFRESH_UI, lparam, 0);
- break;
-
- case WM_REFRESH_UI:
- {
- ptrW szout(g_plugin.getWStringA("UserStamp"));
- CMStringW str = ParseString((szout != NULL) ? szout : DEFAULT_USERSTAMP, wparam);
- SetDlgItemText(hdlg, IDC_INFOTEXT, str);
+ UserinfoDlg() :
+ CUserInfoPageDlg(g_plugin, IDD_USERINFO)
+ {}
- if (!mir_wstrcmp(str, TranslateT("<unknown>")))
- EnableWindow(GetDlgItem(hdlg, IDC_INFOTEXT), FALSE);
- }
- break;
+ bool OnInitDialog() override
+ {
+ mir_subclassWindow(GetDlgItem(m_hwnd, IDC_INFOTEXT), EditProc);
+ WindowList_Add(g_pUserInfo, m_hwnd, m_hContact);
+ return true;
+ }
- case WM_COMMAND:
- if (HIWORD(wparam) == EN_SETFOCUS)
- SetFocus(GetParent(hdlg));
- break;
+ bool OnRefresh() override
+ {
+ ptrW szout(g_plugin.getWStringA("UserStamp"));
+ CMStringW str = ParseString((szout != NULL) ? szout : DEFAULT_USERSTAMP, m_hContact);
+ SetDlgItemText(m_hwnd, IDC_INFOTEXT, str);
- case WM_DESTROY:
- WindowList_Remove(g_pUserInfo, hdlg);
- break;
+ if (!mir_wstrcmp(str, TranslateT("<unknown>")))
+ EnableWindow(GetDlgItem(m_hwnd, IDC_INFOTEXT), FALSE);
+ return false;
}
- return 0;
-}
+ void OnDestroy() override
+ {
+ WindowList_Remove(g_pUserInfo, m_hwnd);
+ }
+};
int UserinfoInit(WPARAM wparam, LPARAM hContact)
{
char *szProto = Proto_GetBaseAccountName(hContact);
if (IsWatchedProtocol(szProto) && !db_get_b(hContact, szProto, "ChatRoom", false)) {
- OPTIONSDIALOGPAGE uip = { sizeof(uip) };
- uip.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
+ USERINFOPAGE uip = {};
uip.szTitle.a = LPGEN("Last seen");
- uip.pfnDlgProc = UserinfoDlgProc;
+ uip.pDialog = new UserinfoDlg();
g_plugin.addUserInfo(wparam, &uip);
}
return 0;
|