tInitial support for horizontally-scrolling GtkCLists under Win32. - vaccinewar… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit aa6852475c8b2f0fa5f5218c2daa59247ce4deb2 | |
parent b6b6239567de41d5831bf703ea6d0821bad727c4 | |
Author: Ben Webb <[email protected]> | |
Date: Thu, 11 Jul 2002 11:18:08 +0000 | |
Initial support for horizontally-scrolling GtkCLists under Win32. | |
Diffstat: | |
M src/gtkport/clist.c | 36 ++++++++++++++++++++---------… | |
1 file changed, 23 insertions(+), 13 deletions(-) | |
--- | |
diff --git a/src/gtkport/clist.c b/src/gtkport/clist.c | |
t@@ -180,9 +180,9 @@ void gtk_clist_realize(GtkWidget *widget) | |
SendMessage(header, HDM_LAYOUT, 0, (LPARAM)&hdl); | |
clist->header_size = wp.cy; | |
widget->hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "", | |
- WS_CHILD | WS_TABSTOP | WS_HSCROLL | |
- | WS_VSCROLL | LBS_OWNERDRAWFIXED | | |
- LBS_NOTIFY, 0, 0, 0, 0, Parent, NULL, | |
+ WS_CHILD | WS_TABSTOP | WS_VSCROLL | |
+ | WS_HSCROLL | LBS_OWNERDRAWFIXED | |
+ | LBS_NOTIFY, 0, 0, 0, 0, Parent, NULL, | |
hInst, NULL); | |
gtk_set_default_font(widget->hWnd); | |
t@@ -270,6 +270,22 @@ void gtk_clist_draw_row(GtkCList *clist, LPDRAWITEMSTRUCT… | |
DrawFocusRect(lpdis->hDC, &lpdis->rcItem); | |
} | |
+static void gtk_clist_set_extent(GtkCList *clist) | |
+{ | |
+ gint i; | |
+ HWND hWnd; | |
+ | |
+ hWnd = GTK_WIDGET(clist)->hWnd; | |
+ if (hWnd) { | |
+ int width = 0; | |
+ | |
+ for (i = 0; i < clist->cols; i++) { | |
+ width += clist->coldata[i].width; | |
+ } | |
+ SendMessage(hWnd, LB_SETHORIZONTALEXTENT, (WPARAM)width, 0); | |
+ } | |
+} | |
+ | |
void gtk_clist_do_auto_resize(GtkCList *clist) | |
{ | |
gint i; | |
t@@ -284,9 +300,9 @@ void gtk_clist_update_all_widths(GtkCList *clist) | |
{ | |
GSList *list; | |
GtkCListRow *row; | |
- gint i; | |
SIZE size; | |
HWND header; | |
+ gint i; | |
header = clist->header; | |
if (header) | |
t@@ -302,6 +318,8 @@ void gtk_clist_update_all_widths(GtkCList *clist) | |
if (row && row->text) | |
gtk_clist_update_widths(clist, row->text); | |
} | |
+ | |
+ gtk_clist_set_extent(clist); | |
} | |
void gtk_clist_update_widths(GtkCList *clist, gchar *text[]) | |
t@@ -503,21 +521,13 @@ void gtk_clist_set_column_width_full(GtkCList *clist, gi… | |
SendMessage(header, HDM_SETITEM, (WPARAM)column, (LPARAM)&hdi); | |
} | |
} | |
+ gtk_clist_set_extent(clist); | |
hWnd = GTK_WIDGET(clist)->hWnd; | |
if (hWnd) | |
InvalidateRect(hWnd, NULL, FALSE); | |
} | |
} | |
-gint gtk_clist_optimal_column_width(GtkCList *clist, gint column) | |
-{ | |
- if (clist && column >= 0 && column < clist->cols) { | |
- return clist->coldata[column].width; | |
- } else { | |
- return 0; | |
- } | |
-} | |
- | |
void gtk_clist_set_selection_mode(GtkCList *clist, GtkSelectionMode mode) | |
{ | |
clist->mode = mode; |