summaryrefslogtreecommitdiff
path: root/protocols/Steam/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-13 15:05:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-13 15:05:51 +0000
commit6d0076208df04f1d161220beb7cd9155330dead9 (patch)
tree234a9fb900eef695da2948e7de9d19190853b6d3 /protocols/Steam/src
parent05cd31c1d99a2adb8bae18b220a728ef66567543 (diff)
dialog fix for Steam
git-svn-id: http://svn.miranda-ng.org/main/trunk@12787 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r--protocols/Steam/src/steam_dialogs.cpp16
-rw-r--r--protocols/Steam/src/steam_dialogs.h22
-rw-r--r--protocols/Steam/src/steam_events.cpp35
-rw-r--r--protocols/Steam/src/steam_proto.h6
4 files changed, 26 insertions, 53 deletions
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp
index 877a826294..13df916cf0 100644
--- a/protocols/Steam/src/steam_dialogs.cpp
+++ b/protocols/Steam/src/steam_dialogs.cpp
@@ -1,7 +1,7 @@
#include "common.h"
CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto) :
- CSuper(proto, IDD_PASSWORD_EDITOR, NULL, false), m_ok(this, IDOK),
+ CSuper(proto, IDD_PASSWORD_EDITOR, false), m_ok(this, IDOK),
m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
{
m_ok.OnClick = Callback(this, &CSteamPasswordEditor::OnOk);
@@ -38,7 +38,7 @@ void CSteamPasswordEditor::OnClose()
/////////////////////////////////////////////////////////////////////////////////
CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, char *domain) :
- CSuper(proto, IDD_GUARD, NULL, false), m_ok(this, IDOK),
+ CSuper(proto, IDD_GUARD, false), m_ok(this, IDOK),
m_text(this, IDC_TEXT), m_link(this, IDC_GETDOMAIN, domain)
{
mir_strcpy(m_domain, domain);
@@ -75,7 +75,7 @@ char * CSteamGuardDialog::GetGuardCode()
/////////////////////////////////////////////////////////////////////////////////
CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, int captchaImageSize) :
- CSuper(proto, IDD_GUARD, NULL, false),
+ CSuper(proto, IDD_GUARD, false),
m_ok(this, IDOK), m_text(this, IDC_TEXT)
{
m_captchaImageSize = captchaImageSize;
@@ -166,10 +166,12 @@ char * CSteamCaptchaDialog::GetCaptchaText()
/////////////////////////////////////////////////////////////////////////////////
CSteamOptionsMain::CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent)
- : CSuper(proto, idDialog, hwndParent, false),
+ : CSuper(proto, idDialog, false),
m_username(this, IDC_USERNAME), m_password(this, IDC_PASSWORD),
m_group(this, IDC_GROUP), m_biggerAvatars(this, IDC_BIGGER_AVATARS)
{
+ SetParent(hwndParent);
+
CreateLink(m_username, "Username", _T(""));
CreateLink(m_password, "Password", _T(""));
CreateLink(m_group, "DefaultGroup", _T("Steam"));
@@ -213,8 +215,10 @@ void CSteamOptionsMain::OnApply()
/////////////////////////////////////////////////////////////////////////////////
CSteamOptionsBlockList::CSteamOptionsBlockList(CSteamProto *proto)
- : CSuper(proto, IDD_OPT_BLOCK_LIST, NULL, false), m_list(this, IDC_LIST),
- m_contacts(this, IDC_CONTACTS), m_add(this, IDC_BLOCK)
+ : CSuper(proto, IDD_OPT_BLOCK_LIST, false),
+ m_list(this, IDC_LIST),
+ m_contacts(this, IDC_CONTACTS),
+ m_add(this, IDC_BLOCK)
{
m_add.OnClick = Callback(this, &CSteamOptionsBlockList::OnBlock);
}
diff --git a/protocols/Steam/src/steam_dialogs.h b/protocols/Steam/src/steam_dialogs.h
index dd919fa365..768d87c75c 100644
--- a/protocols/Steam/src/steam_dialogs.h
+++ b/protocols/Steam/src/steam_dialogs.h
@@ -1,15 +1,7 @@
#ifndef _STEAM_DIALOGS_H_
#define _STEAM_DIALOGS_H_
-class CSteamDlgBase : public CProtoDlgBase<CSteamProto>
-{
-private:
- typedef CProtoDlgBase<CSteamProto> CSuper;
-
-protected:
- __inline CSteamDlgBase(CSteamProto *proto, int idDialog, HWND parent, bool show_label = true) :
- CSuper(proto, idDialog, parent, show_label) { }
-};
+typedef CProtoDlgBase<CSteamProto> CSteamDlgBase;
/////////////////////////////////////////////////////////////////////////////////
@@ -97,20 +89,18 @@ private:
CCtrlCheck m_biggerAvatars;
protected:
- CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent = NULL);
-
void OnInitDialog();
void OnApply();
public:
+ CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent = NULL);
+
static CDlgBase *CreateAccountManagerPage(void *param, HWND owner)
{
CSteamOptionsMain *page = new CSteamOptionsMain((CSteamProto*)param, IDD_ACCMGR, owner);
page->Show();
return page;
}
-
- static CDlgBase *CreateOptionsPage(void *param) { return new CSteamOptionsMain((CSteamProto*)param, IDD_OPT_MAIN); }
};
////////////////////////////////////////////////////////////////////////////////
@@ -124,14 +114,12 @@ private:
CCtrlCombo m_contacts;
CCtrlButton m_add;
-protected:
+public:
CSteamOptionsBlockList(CSteamProto *proto);
+protected:
void OnInitDialog();
void OnBlock(CCtrlButton*);
-
-public:
- static CDlgBase *CreateOptionsPage(void *param) { return new CSteamOptionsBlockList((CSteamProto*)param); }
};
#endif //_STEAM_DIALOGS_H_ \ No newline at end of file
diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp
index bbf707886e..7a31c566cd 100644
--- a/protocols/Steam/src/steam_events.cpp
+++ b/protocols/Steam/src/steam_events.cpp
@@ -2,7 +2,7 @@
int CSteamProto::OnModulesLoaded(WPARAM, LPARAM)
{
- HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, this);
+ HookProtoEvent(ME_OPT_INITIALISE, &CSteamProto::OnOptionsInit);
HookProtoEvent(ME_IDLE_CHANGED, &CSteamProto::OnIdleChanged);
TCHAR name[128];
@@ -34,36 +34,21 @@ INT_PTR CSteamProto::OnAccountManagerInit(WPARAM wParam, LPARAM lParam)
return (INT_PTR)(CSteamOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd();
}
-int CSteamProto::OnOptionsInit(void *obj, WPARAM wParam, LPARAM lParam)
+int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
{
- CSteamProto *instance = (CSteamProto*)obj;
-
- char *title = mir_t2a(instance->m_tszUserName);
-
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = g_hInstance;
- odp.pszTitle = title;
- odp.flags = ODPF_BOLDGROUPS;
- odp.pszGroup = LPGEN("Network");
-
- odp.pszTab = LPGEN("Account");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN);
- odp.pfnDlgProc = CSteamOptionsMain::DynamicDlgProc;
- odp.dwInitParam = (LPARAM)&instance->SteamMainOptionsParam;
- instance->SteamMainOptionsParam.create = CSteamOptionsMain::CreateOptionsPage;
- instance->SteamMainOptionsParam.param = instance;
- Options_AddPage(wParam, &odp);
+ odp.ptszTitle = m_tszUserName;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ odp.ptszGroup = LPGENT("Network");
- odp.pszTab = LPGEN("Blocked contacts");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BLOCK_LIST);
- odp.pfnDlgProc = CSteamOptionsMain::DynamicDlgProc;
- odp.dwInitParam = (LPARAM)&instance->SteamBlockListOptionsParam;
- instance->SteamBlockListOptionsParam.create = CSteamOptionsBlockList::CreateOptionsPage;
- instance->SteamBlockListOptionsParam.param = instance;
+ odp.ptszTab = LPGENT("Account");
+ odp.pDialog = new CSteamOptionsMain(this, IDD_OPT_MAIN);
Options_AddPage(wParam, &odp);
- mir_free(title);
-
+ odp.ptszTab = LPGENT("Blocked contacts");
+ odp.pDialog = new CSteamOptionsBlockList(this);
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index 0c06e708ca..bcddfdb6b3 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -246,10 +246,6 @@ protected:
void OnInitStatusMenu();
- // options
- CSteamDlgBase::CreateParam SteamMainOptionsParam;
- CSteamDlgBase::CreateParam SteamBlockListOptionsParam;
-
// avatars
TCHAR* GetAvatarFilePath(MCONTACT hContact);
bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &pai);
@@ -270,8 +266,8 @@ protected:
int OnModulesLoaded(WPARAM, LPARAM);
int OnPreShutdown(WPARAM, LPARAM);
int __cdecl OnIdleChanged(WPARAM, LPARAM);
+ int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnAccountManagerInit(WPARAM wParam, LPARAM lParam);
- static int __cdecl OnOptionsInit(void *obj, WPARAM wParam, LPARAM lParam);
// utils
static WORD SteamToMirandaStatus(int state);