summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_frame.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-11-09 09:19:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-11-09 09:19:38 +0000
commit581844d52f2b91a45240a1e7bf7cd95cc93b0837 (patch)
tree5f16a4047144eeca67deb3dd3b7d98cd191a6096 /protocols/JabberG/src/jabber_frame.cpp
parentb067cb5f4dd97509448956205c41f96cce6f8473 (diff)
fix for the frame processing in Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@15702 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_frame.cpp')
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp94
1 files changed, 55 insertions, 39 deletions
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index 63ef368c46..1191a99bd8 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -75,54 +75,55 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
m_proto = proto;
m_clickedItem = -1;
- if (!proto->m_options.DisableFrame && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- InitClass();
-
- CLISTFrame frame = { sizeof(frame) };
- HWND hwndClist = pcli->hwndContactList;
- frame.hWnd = CreateWindowEx(0, _T("JabberInfoFrameClass"), NULL, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, NULL, hInst, this);
- frame.align = alBottom;
- frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
- frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR;
- frame.tname = mir_a2t(proto->m_szModuleName);
- frame.TBtname = proto->m_tszUserName;
- m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
- mir_free(frame.tname);
- if (m_frameId == -1) {
- DestroyWindow(frame.hWnd);
- return;
- }
+ InitClass();
+
+ CLISTFrame frame = { sizeof(frame) };
+ HWND hwndClist = pcli->hwndContactList;
+ frame.hWnd = CreateWindowEx(0, _T("JabberInfoFrameClass"), NULL, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, NULL, hInst, this);
+ frame.align = alBottom;
+ frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
+ frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR;
+ frame.tname = mir_a2t(proto->m_szModuleName);
+ frame.TBtname = proto->m_tszUserName;
+ m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
+ mir_free(frame.tname);
+ if (m_frameId == -1) {
+ DestroyWindow(frame.hWnd);
+ return;
+ }
- m_hhkFontsChanged = HookEventMessage(ME_FONT_RELOAD, m_hwnd, WM_APP);
- ReloadFonts();
+ m_hhkFontsChanged = HookEventMessage(ME_FONT_RELOAD, m_hwnd, WM_APP);
+ ReloadFonts();
- m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- m_hwnd, NULL, hInst, NULL);
- SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
+ WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ m_hwnd, NULL, hInst, NULL);
+ SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- CreateInfoItem("$", true);
- UpdateInfoItem("$", proto->GetIconHandle(IDI_JABBER), proto->m_tszUserName);
+ CreateInfoItem("$", true);
+ UpdateInfoItem("$", proto->GetIconHandle(IDI_JABBER), proto->m_tszUserName);
- CreateInfoItem("$/JID", true);
- UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), _T("Offline"));
- SetInfoItemCallback("$/JID", &CJabberProto::InfoFrame_OnSetup);
- }
+ CreateInfoItem("$/JID", true);
+ UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), _T("Offline"));
+ SetInfoItemCallback("$/JID", &CJabberProto::InfoFrame_OnSetup);
}
CJabberInfoFrame::~CJabberInfoFrame()
{
- if (!m_hwnd) return;
-
- if (m_hhkFontsChanged) UnhookEvent(m_hhkFontsChanged);
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)m_frameId, 0);
- SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
- DestroyWindow(m_hwnd);
- DestroyWindow(m_hwndToolTip);
- DeleteObject(m_hfntText);
- DeleteObject(m_hfntTitle);
- m_hwnd = NULL;
+
+ if (m_hhkFontsChanged)
+ UnhookEvent(m_hhkFontsChanged);
+
+ if (m_hwnd != NULL) {
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
+ DestroyWindow(m_hwnd);
+ DestroyWindow(m_hwndToolTip);
+ DeleteObject(m_hfntText);
+ DeleteObject(m_hfntTitle);
+ m_hwnd = NULL;
+ }
}
void CJabberInfoFrame::InitClass()
@@ -497,3 +498,18 @@ void CJabberInfoFrame::RemoveInfoItem(char *pszName)
if (bUpdate)
UpdateSize();
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CJabberProto::InitInfoFrame()
+{
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ return;
+
+ if (!m_options.DisableFrame)
+ m_pInfoFrame = new CJabberInfoFrame(this);
+ else {
+ delete m_pInfoFrame;
+ m_pInfoFrame = NULL;
+ }
+}