Mercurial > dwindows
comparison gtk3/dw.c @ 1583:525c4c9d04c6
After switching to non-deprecated functions in GTK3 like...
gtk_paned_new() the orientation detection macros I had been using...
GTK_IS_HPANED(), GTK_IS_VPANED() etc no longer work...
have to use gtk_orientable_get_orientation() to detect the orientation now.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 26 Jan 2012 14:36:48 +0000 |
parents | 245e6bf51317 |
children | ed09531b7f0e |
comparison
equal
deleted
inserted
replaced
1582:728778634933 | 1583:525c4c9d04c6 |
---|---|
1677 | 1677 |
1678 if (work.window) | 1678 if (work.window) |
1679 { | 1679 { |
1680 int (*valuechangedfunc)(HWND, int, void *) = work.func; | 1680 int (*valuechangedfunc)(HWND, int, void *) = work.func; |
1681 | 1681 |
1682 if(slider && GTK_IS_VSCALE(slider)) | 1682 if(slider && gtk_orientable_get_orientation(GTK_ORIENTABLE(slider)) == GTK_ORIENTATION_VERTICAL) |
1683 valuechangedfunc(work.window, (max - val) - 1, work.data); | 1683 valuechangedfunc(work.window, (max - val) - 1, work.data); |
1684 else | 1684 else |
1685 valuechangedfunc(work.window, val, work.data); | 1685 valuechangedfunc(work.window, val, work.data); |
1686 } | 1686 } |
1687 } | 1687 } |
4859 if(adjustment) | 4859 if(adjustment) |
4860 { | 4860 { |
4861 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; | 4861 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; |
4862 int thisval = _round_value(gtk_adjustment_get_value(adjustment)); | 4862 int thisval = _round_value(gtk_adjustment_get_value(adjustment)); |
4863 | 4863 |
4864 if(GTK_IS_VSCALE(handle)) | 4864 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(handle)) == GTK_ORIENTATION_VERTICAL) |
4865 val = max - thisval; | 4865 val = max - thisval; |
4866 else | 4866 else |
4867 val = thisval; | 4867 val = thisval; |
4868 } | 4868 } |
4869 DW_MUTEX_UNLOCK; | 4869 DW_MUTEX_UNLOCK; |
4888 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); | 4888 adjustment = (GtkAdjustment *)g_object_get_data(G_OBJECT(handle), "_dw_adjustment"); |
4889 if(adjustment) | 4889 if(adjustment) |
4890 { | 4890 { |
4891 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; | 4891 int max = _round_value(gtk_adjustment_get_upper(adjustment)) - 1; |
4892 | 4892 |
4893 if(GTK_IS_VSCALE(handle)) | 4893 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(handle)) == GTK_ORIENTATION_VERTICAL) |
4894 gtk_adjustment_set_value(adjustment, (gfloat)(max - position)); | 4894 gtk_adjustment_set_value(adjustment, (gfloat)(max - position)); |
4895 else | 4895 else |
4896 gtk_adjustment_set_value(adjustment, (gfloat)position); | 4896 gtk_adjustment_set_value(adjustment, (gfloat)position); |
4897 } | 4897 } |
4898 DW_MUTEX_UNLOCK; | 4898 DW_MUTEX_UNLOCK; |
9962 { | 9962 { |
9963 GtkAllocation alloc; | 9963 GtkAllocation alloc; |
9964 | 9964 |
9965 gtk_widget_get_allocation(widget, &alloc); | 9965 gtk_widget_get_allocation(widget, &alloc); |
9966 | 9966 |
9967 if(GTK_IS_HPANED(widget)) | 9967 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(widget)) == GTK_ORIENTATION_HORIZONTAL) |
9968 gtk_paned_set_position(GTK_PANED(widget), (int)(alloc.width * (*percent / 100.0))); | 9968 gtk_paned_set_position(GTK_PANED(widget), (int)(alloc.width * (*percent / 100.0))); |
9969 if(GTK_IS_VPANED(widget)) | 9969 else |
9970 gtk_paned_set_position(GTK_PANED(widget), (int)(alloc.height * (*percent / 100.0))); | 9970 gtk_paned_set_position(GTK_PANED(widget), (int)(alloc.height * (*percent / 100.0))); |
9971 g_object_set_data(G_OBJECT(widget), "_dw_percent", NULL); | 9971 g_object_set_data(G_OBJECT(widget), "_dw_percent", NULL); |
9972 free(percent); | 9972 free(percent); |
9973 } | 9973 } |
9974 return FALSE; | 9974 return FALSE; |
10023 void dw_splitbar_set(HWND handle, float percent) | 10023 void dw_splitbar_set(HWND handle, float percent) |
10024 { | 10024 { |
10025 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); | 10025 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
10026 int size = 0, position; | 10026 int size = 0, position; |
10027 | 10027 |
10028 if(GTK_IS_VPANED(handle)) | 10028 if(gtk_orientable_get_orientation(GTK_ORIENTABLE(handle)) == GTK_ORIENTATION_HORIZONTAL) |
10029 size = gtk_widget_get_allocated_width(handle); | |
10030 else | |
10029 size = gtk_widget_get_allocated_height(handle); | 10031 size = gtk_widget_get_allocated_height(handle); |
10030 else if(GTK_IS_HPANED(handle)) | |
10031 size = gtk_widget_get_allocated_width(handle); | |
10032 | 10032 |
10033 if(mypercent) | 10033 if(mypercent) |
10034 *mypercent = percent; | 10034 *mypercent = percent; |
10035 | 10035 |
10036 if(size > 10) | 10036 if(size > 10) |
10918 { | 10918 { |
10919 HWND thiswindow = window; | 10919 HWND thiswindow = window; |
10920 | 10920 |
10921 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) | 10921 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) |
10922 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); | 10922 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
10923 else if(GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) || | 10923 else if(GTK_IS_SCALE(thiswindow) || GTK_IS_SCROLLBAR(thiswindow) || GTK_IS_SPIN_BUTTON(thiswindow)) |
10924 GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow) || | |
10925 GTK_IS_SPIN_BUTTON(thiswindow)) | |
10926 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); | 10924 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); |
10927 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) | 10925 else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
10928 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); | 10926 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
10929 return thiswindow; | 10927 return thiswindow; |
10930 } | 10928 } |
11030 thisname = "focus-out-event"; | 11028 thisname = "focus-out-event"; |
11031 if(GTK_IS_COMBO_BOX(thiswindow)) | 11029 if(GTK_IS_COMBO_BOX(thiswindow)) |
11032 thiswindow = GTK_COMBO_BOX(thiswindow)->entry; | 11030 thiswindow = GTK_COMBO_BOX(thiswindow)->entry; |
11033 } | 11031 } |
11034 #endif | 11032 #endif |
11035 else if (GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) || | 11033 else if (GTK_IS_SCALE(thiswindow) || GTK_IS_SCROLLBAR(thiswindow) || GTK_IS_SPIN_BUTTON(thiswindow) ) |
11036 GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow) || | |
11037 GTK_IS_SPIN_BUTTON(thiswindow) ) | |
11038 { | 11034 { |
11039 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); | 11035 thiswindow = (GtkWidget *)g_object_get_data(G_OBJECT(thiswindow), "_dw_adjustment"); |
11040 } | 11036 } |
11041 else if (GTK_IS_NOTEBOOK(thiswindow) && strcmp(signame, DW_SIGNAL_SWITCH_PAGE) == 0) | 11037 else if (GTK_IS_NOTEBOOK(thiswindow) && strcmp(signame, DW_SIGNAL_SWITCH_PAGE) == 0) |
11042 { | 11038 { |