soc.2009.vulture: 399841fe: Created various controls in main window....
gdick at soc.pidgin.im
gdick at soc.pidgin.im
Sat May 30 17:50:35 EDT 2009
-----------------------------------------------------------------
Revision: 399841fe87f738f85f95b6a25df43ee34c8e57c8
Ancestor: ea07c7cbe172cb4ef521f29e2f0c0385492df182
Author: gdick at soc.pidgin.im
Date: 2009-05-30T19:20:14
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/399841fe87f738f85f95b6a25df43ee34c8e57c8
Modified files:
libpurple/win32/rules.mak vulture/blist.c vulture/blist.h
vulture/resource.h vulture/vulture-res.rc vulture/vulture.c
ChangeLog:
Created various controls in main window. Not actually functional yet.
-------------- next part --------------
============================================================
--- libpurple/win32/rules.mak f9869497a15873472135a0670dc257546907071a
+++ libpurple/win32/rules.mak e1e3dec879f4df6944dede810d864dbf92413031
@@ -7,4 +7,4 @@
$(PERL) $(EXTUTILS)/xsubpp -typemap $(EXTUTILS)/typemap -typemap $(PURPLE_PERL_TOP)/common/typemap $< > $@
%.o: %.rc
- $(WINDRES) -I$(PURPLE_TOP) -i $< -o $@
+ $(WINDRES) -I$(PURPLE_TOP) $(DEFINES) -i $< -o $@
============================================================
--- vulture/blist.c 70d00810fc372048e7bef93d66bdcc469ebb2fa7
+++ vulture/blist.c 56f75bf04a556947f36b9903a757118a13b244e0
@@ -23,29 +23,35 @@
#include <windows.h>
#include "vulture.h"
+#include "resource.h"
#include "blist.h"
-static LRESULT CALLBACK BuddyListProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+static INT_PTR CALLBACK StatusDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+static INT_PTR CALLBACK BuddyListDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
-static HWND g_hwndBuddyList = NULL;
+#define BLIST_MARGIN 6
+static HWND g_hwndMain = NULL;
+
+
/**
- * Creates the buddy list.
+ * Creates the main window, incorporating the buddy list.
*
* @param iCmdShow Initial window state. Cf. ShowWindow.
*
* @return Zero on success; non-zero on error.
*/
-int VultureCreateBuddyList(int iCmdShow)
+int VultureCreateMainWindow(int iCmdShow)
{
- const TCHAR c_szClassName[] = TEXT("VULTUREBLIST");
+ const TCHAR c_szClassName[] = TEXT("VULTUREMAIN");
WNDCLASSEX wndclassex;
- if(g_hwndBuddyList)
+ if(g_hwndMain)
return 1;
wndclassex.cbClsExtra = 0;
@@ -56,16 +62,16 @@ int VultureCreateBuddyList(int iCmdShow)
wndclassex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclassex.hIconSm = LoadImage(NULL, IDI_APPLICATION, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED);
wndclassex.hInstance = g_hInstance;
- wndclassex.lpfnWndProc = BuddyListProc;
+ wndclassex.lpfnWndProc = MainWndProc;
wndclassex.lpszClassName = c_szClassName;
- wndclassex.lpszMenuName = NULL;
+ wndclassex.lpszMenuName = MAKEINTRESOURCE(IDM_BLIST);
wndclassex.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
if(!RegisterClassEx(&wndclassex))
return 2;
- g_hwndBuddyList = CreateWindowEx(
- WS_EX_OVERLAPPEDWINDOW,
+ g_hwndMain = CreateWindowEx(
+ WS_EX_WINDOWEDGE,
c_szClassName,
cg_szAppName,
WS_OVERLAPPEDWINDOW,
@@ -79,17 +85,17 @@ int VultureCreateBuddyList(int iCmdShow)
g_hInstance,
NULL);
- if(!g_hwndBuddyList)
+ if(!g_hwndMain)
return 3;
- ShowWindow(g_hwndBuddyList, iCmdShow);
+ ShowWindow(g_hwndMain, iCmdShow);
return 0;
}
/**
- * Buddy-list window procedure.
+ * Main window procedure.
*
* @param hwnd Buddy-list handle.
* @param uiMsg Message ID.
@@ -98,14 +104,160 @@ int VultureCreateBuddyList(int iCmdShow)
*
* @return Message-specific.
*/
-static LRESULT CALLBACK BuddyListProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
+ static HWND s_hwndStatusDlg = NULL, s_hwndBListDlg = NULL;
+
switch(uiMsg)
{
+ case WM_CREATE:
+
+ s_hwndStatusDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_STATUS), hwnd, StatusDlgProc);
+ s_hwndBListDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_BLIST), hwnd, BuddyListDlgProc);
+
+ return 0;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDM_BLIST_BUDDIES_CLOSE:
+ SendMessage(hwnd, WM_CLOSE, 0, 0);
+ return 0;
+ }
+
+ break;
+
+ case WM_SIZE:
+ {
+ HDWP hdwp;
+ RECT rcClient, rcStatus;
+
+ GetClientRect(hwnd, &rcClient);
+ GetWindowRect(s_hwndStatusDlg, &rcStatus);
+
+ hdwp = BeginDeferWindowPos(2);
+ hdwp = DeferWindowPos(hdwp, s_hwndStatusDlg, NULL, 0, 0, rcClient.right, rcStatus.bottom - rcStatus.top, SWP_NOACTIVATE | SWP_NOZORDER);
+ rcClient.top = rcStatus.bottom - rcStatus.top;
+ hdwp = DeferWindowPos(hdwp, s_hwndBListDlg, NULL, 0, rcClient.top, rcClient.right, rcClient.bottom - rcClient.top, SWP_NOACTIVATE | SWP_NOZORDER);
+ EndDeferWindowPos(hdwp);
+ }
+
+ return 0;
+
+ case WM_ERASEBKGND:
+ /* Don't erase background: we never see it. Reduces flicker. */
+ return 0;
+
case WM_DESTROY:
+ DestroyWindow(s_hwndBListDlg);
+ DestroyWindow(s_hwndStatusDlg);
PostQuitMessage(VEC_SUCCESS);
return 0;
}
return DefWindowProc(hwnd, uiMsg, wParam, lParam);
}
+
+
+/**
+ * Dialogue procedure for status pane.
+ *
+ * @param hwndDlg Dialogue window handle.
+ * @param uiMsg Message ID.
+ * @param wParam Message-specific.
+ * @param lParam Message-specific.
+ *
+ * @return Usually TRUE if message processed and FALSE otherwise. There are
+ * some exceptions for particular messages.
+ */
+static INT_PTR CALLBACK StatusDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uiMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ RECT rcIcon;
+ POINT ptIcon;
+
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_BUDDY_ICON), &rcIcon);
+ ptIcon.x = rcIcon.left;
+ ptIcon.y = rcIcon.top;
+ ScreenToClient(hwndDlg, &ptIcon);
+
+ /* Move BLIST_MARGIN from left edge, and set width to
+ * height.
+ */
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_BUDDY_ICON), NULL, BLIST_MARGIN, ptIcon.y, rcIcon.bottom - rcIcon.top, rcIcon.bottom - rcIcon.top, SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+
+ /* Let the system set the focus. */
+ return TRUE;
+
+ case WM_SIZE:
+ {
+ HDWP hdwp;
+ RECT rcClient, rcCombo, rcEdit;
+ HWND hwndCombo = GetDlgItem(hwndDlg, IDC_CBEX_STATUS);
+ HWND hwndEdit = GetDlgItem(hwndDlg, IDC_EDIT_STATUSMSG);
+ POINT ptCombo;
+ int cxNew;
+
+ GetClientRect(hwndDlg, &rcClient);
+
+ /* Resize status combo and edit boxes. */
+
+ GetWindowRect(hwndCombo, &rcCombo);
+ GetWindowRect(hwndEdit, &rcEdit);
+
+ ptCombo.x = rcCombo.left;
+ ptCombo.y = rcCombo.top;
+ ScreenToClient(hwndDlg, &ptCombo);
+
+ /* Width is same for both. */
+ cxNew = rcClient.right - BLIST_MARGIN - ptCombo.x;
+
+ hdwp = BeginDeferWindowPos(2);
+ hdwp = DeferWindowPos(hdwp, hwndCombo, NULL, 0, 0, cxNew, rcCombo.bottom - rcCombo.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
+ hdwp = DeferWindowPos(hdwp, hwndEdit, NULL, 0, 0, cxNew, rcEdit.bottom - rcEdit.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
+ EndDeferWindowPos(hdwp);
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/**
+ * Dialogue procedure for buddy list.
+ *
+ * @param hwndDlg Dialogue window handle.
+ * @param uiMsg Message ID.
+ * @param wParam Message-specific.
+ * @param lParam Message-specific.
+ *
+ * @return Usually TRUE if message processed and FALSE otherwise. There are
+ * some exceptions for particular messages.
+ */
+static INT_PTR CALLBACK BuddyListDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uiMsg)
+ {
+ case WM_INITDIALOG:
+ /* Let the system set the focus. */
+ return TRUE;
+
+ case WM_SIZE:
+ {
+ RECT rcClient;
+
+ GetClientRect(hwndDlg, &rcClient);
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_TREE_BLIST), NULL, BLIST_MARGIN, 0, rcClient.right - 2 * BLIST_MARGIN, rcClient.bottom - BLIST_MARGIN, SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
============================================================
--- vulture/blist.h e2472be02ecfeeef66940c5d07b205bb583e6620
+++ vulture/blist.h 76aebfd775faba9602b1fce5b54e90dbd9cb3e74
@@ -23,6 +23,6 @@
#ifndef _VULTURE_BLIST_H_
#define _VULTURE_BLIST_H_
-int VultureCreateBuddyList(int iCmdShow);
+int VultureCreateMainWindow(int iCmdShow);
#endif
============================================================
--- vulture/resource.h 65e7f36ab4e1a2ec0043ec83a05cf7bdc72edc08
+++ vulture/resource.h e65c6ee61ea44d34d795c8b771a85002d69337c3
@@ -2,5 +2,13 @@
#define IDC_STATIC (-1)
#endif
+#define IDD_STATUS 101
+#define IDM_BLIST 103
+#define IDD_BLIST 105
+#define IDC_BUDDY_ICON 1002
+#define IDC_CBEX_STATUS 1004
+#define IDM_BLIST_BUDDIES_CLOSE 40000
#define IDS_ERROR_BLIST 40000
#define IDS_ERROR_PURPLEINIT 40001
+#define IDC_EDIT_STATUSMSG 40003
+#define IDC_TREE_BLIST 40004
============================================================
--- vulture/vulture-res.rc ec1f630c519111c7c066049bf110f516f5564512
+++ vulture/vulture-res.rc c1a27394163593e53bc674ad4a3ed7c5c924f922
@@ -9,6 +9,45 @@
//
+// Menu resources
+//
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+IDM_BLIST MENU
+{
+ POPUP "&Buddies"
+ {
+ MENUITEM "&Close", IDM_BLIST_BUDDIES_CLOSE
+ }
+}
+
+
+
+//
+// Dialog resources
+//
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+IDD_BLIST DIALOG 0, 0, 186, 95
+STYLE DS_3DLOOK | DS_CENTER | DS_CONTROL | DS_SHELLFONT | WS_VISIBLE | WS_CHILDWINDOW
+FONT 8, "Ms Shell Dlg"
+{
+ CONTROL "", IDC_TREE_BLIST, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_INFOTIP | TVS_FULLROWSELECT, 5, 5, 175, 85
+}
+
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+IDD_STATUS DIALOG 0, 0, 161, 41
+STYLE DS_3DLOOK | DS_CENTER | DS_CONTROL | DS_SHELLFONT | WS_VISIBLE | WS_CHILDWINDOW
+FONT 8, "Ms Shell Dlg"
+{
+ CONTROL "", IDC_BUDDY_ICON, WC_STATIC, WS_TABSTOP | SS_BLACKFRAME | SS_NOTIFY | SS_SUNKEN, 5, 5, 30, 30
+ CONTROL "1", IDC_CBEX_STATUS, "ComboBoxEx32", CBS_DROPDOWNLIST, 40, 5, 115, 90
+ EDITTEXT IDC_EDIT_STATUSMSG, 40, 20, 115, 15, ES_AUTOHSCROLL | ES_WANTRETURN
+}
+
+
+
+//
// String Table resources
//
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
@@ -18,3 +57,11 @@ STRINGTABLE
IDS_ERROR_BLIST "Couldn't initialise buddy list."
IDS_ERROR_PURPLEINIT "Couldn't initialise libpurple."
}
+
+
+
+//
+// Manifest resources
+//
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+1 RT_MANIFEST ".\\manifest.xml"
============================================================
--- vulture/vulture.c d96f4fadf76c395f46e5bdccc13cb2aed439d2cb
+++ vulture/vulture.c 1fac65820b68cc8ba568c705c82fd5c4c2504038
@@ -57,7 +57,7 @@ int WINAPI WinMain(HINSTANCE hinst, HINS
VultureParseCommandLine();
- if(VultureCreateBuddyList(iCmdShow) != 0)
+ if(VultureCreateMainWindow(iCmdShow) != 0)
{
MessageBoxFromStringTable(NULL, IDS_ERROR_BLIST, MB_ICONERROR);
return VEC_ERROR_BLIST;
More information about the Commits
mailing list