Mercurial > dwindows
comparison gtk/dw.c @ 1546:189b27f24d64
Attempt to find the size of contents on GTK2 while packing.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 13 Jan 2012 15:20:51 +0000 |
parents | 6edf3fce77f2 |
children | 4a9c574d5c17 |
comparison
equal
deleted
inserted
replaced
1545:6edf3fce77f2 | 1546:189b27f24d64 |
---|---|
10117 gtk_object_set_data(GTK_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount + 1)); | 10117 gtk_object_set_data(GTK_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount + 1)); |
10118 { | 10118 { |
10119 int thiswidth = width, thisheight = height; | 10119 int thiswidth = width, thisheight = height; |
10120 | 10120 |
10121 /* If it is a scrolled item and not expandable... | 10121 /* If it is a scrolled item and not expandable... |
10122 * set the default size to 500x200. | 10122 * Clamp to minumum or maximum. |
10123 */ | 10123 */ |
10124 if(GTK_IS_SCROLLED_WINDOW(item)) | 10124 if(GTK_IS_SCROLLED_WINDOW(item)) |
10125 { | 10125 { |
10126 if(thiswidth < 1 && !hsize) | 10126 GtkWidget *widget = gtk_object_get_user_data(GTK_OBJECT(item)); |
10127 thiswidth = 500; | 10127 |
10128 if(thisheight < 1 && !vsize) | 10128 /* Try to figure out the contents for MLE and Container */ |
10129 thisheight = 200; | 10129 if(widget && (GTK_IS_TEXT_VIEW(widget) || GTK_IS_CLIST(widget))) |
10130 { | |
10131 GtkRequisition req; | |
10132 | |
10133 gtk_widget_size_request(widget, &req); | |
10134 | |
10135 if(thiswidth < 1 && !hsize) | |
10136 { | |
10137 thiswidth = req.width + 20; | |
10138 if(thiswidth < _DW_SCROLLED_MIN_WIDTH) | |
10139 thiswidth = _DW_SCROLLED_MIN_WIDTH; | |
10140 if(thiswidth > _DW_SCROLLED_MAX_WIDTH) | |
10141 thiswidth = _DW_SCROLLED_MAX_WIDTH; | |
10142 } | |
10143 if(thisheight < 1 && !vsize) | |
10144 { | |
10145 thisheight = req.height + 20; | |
10146 if(thisheight < _DW_SCROLLED_MIN_HEIGHT) | |
10147 thisheight = _DW_SCROLLED_MIN_HEIGHT; | |
10148 if(thisheight > _DW_SCROLLED_MAX_HEIGHT) | |
10149 thisheight = _DW_SCROLLED_MAX_HEIGHT; | |
10150 } | |
10151 } | |
10152 else | |
10153 { | |
10154 /* Set to max for others */ | |
10155 if(thiswidth < 1 && !hsize) | |
10156 thiswidth = _DW_SCROLLED_MAX_WIDTH; | |
10157 if(thisheight < 1 && !vsize) | |
10158 thisheight = _DW_SCROLLED_MAX_HEIGHT; | |
10159 } | |
10130 } | 10160 } |
10131 gtk_widget_set_usize(item, thiswidth, thisheight); | 10161 gtk_widget_set_usize(item, thiswidth, thisheight); |
10132 } | 10162 } |
10133 if(GTK_IS_RADIO_BUTTON(item)) | 10163 if(GTK_IS_RADIO_BUTTON(item)) |
10134 { | 10164 { |