Mercurial > audlegacy
comparison src/audacious/ui_skinned_textbox.c @ 3222:bb7f5adc1677 trunk
I hope textbox_resize_relative is now working propertly
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Thu, 02 Aug 2007 16:10:32 +0200 |
parents | 19908efce4e5 |
children | 939a44cae771 |
comparison
equal
deleted
inserted
replaced
3221:9583cd62231f | 3222:bb7f5adc1677 |
---|---|
62 gboolean is_scrollable, is_dragging; | 62 gboolean is_scrollable, is_dragging; |
63 gint pixmap_width; | 63 gint pixmap_width; |
64 GdkPixmap *pixmap; | 64 GdkPixmap *pixmap; |
65 gboolean scroll_allowed, scroll_enabled; | 65 gboolean scroll_allowed, scroll_enabled; |
66 gint scroll_dummy; | 66 gint scroll_dummy; |
67 gint resize_width, resize_height; | 67 gint resize_width; |
68 gint move_x, move_y; | 68 gint move_x, move_y; |
69 }; | 69 }; |
70 | 70 |
71 static void ui_skinned_textbox_class_init (UiSkinnedTextboxClass *klass); | 71 static void ui_skinned_textbox_class_init (UiSkinnedTextboxClass *klass); |
72 static void ui_skinned_textbox_init (UiSkinnedTextbox *textbox); | 72 static void ui_skinned_textbox_init (UiSkinnedTextbox *textbox); |
164 } | 164 } |
165 | 165 |
166 static void ui_skinned_textbox_init(UiSkinnedTextbox *textbox) { | 166 static void ui_skinned_textbox_init(UiSkinnedTextbox *textbox) { |
167 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); | 167 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); |
168 priv->resize_width = 0; | 168 priv->resize_width = 0; |
169 priv->resize_height = 0; | |
170 priv->move_x = 0; | 169 priv->move_x = 0; |
171 priv->move_y = 0; | 170 priv->move_y = 0; |
172 } | 171 } |
173 | 172 |
174 GtkWidget* ui_skinned_textbox_new(GtkWidget *fixed, gint x, gint y, gint w, gboolean allow_scroll, SkinPixmapId si) { | 173 GtkWidget* ui_skinned_textbox_new(GtkWidget *fixed, gint x, gint y, gint w, gboolean allow_scroll, SkinPixmapId si) { |
264 priv->move_y = 0; | 263 priv->move_y = 0; |
265 textbox->x = widget->allocation.x/(priv->double_size ? 2 : 1); | 264 textbox->x = widget->allocation.x/(priv->double_size ? 2 : 1); |
266 textbox->y = widget->allocation.y/(priv->double_size ? 2 : 1); | 265 textbox->y = widget->allocation.y/(priv->double_size ? 2 : 1); |
267 | 266 |
268 if (textbox->width != widget->allocation.width/(priv->double_size ? 2 : 1)) { | 267 if (textbox->width != widget->allocation.width/(priv->double_size ? 2 : 1)) { |
269 if (textbox->width + priv->resize_width == widget->allocation.width/(priv->double_size ? 2 : 1)) | 268 if (textbox->width + priv->resize_width == widget->allocation.width/(priv->double_size ? 2 : 1)) { |
269 textbox->width += priv->resize_width; | |
270 priv->resize_width = 0; | 270 priv->resize_width = 0; |
271 textbox->width = widget->allocation.width/(priv->double_size ? 2 : 1); | 271 if (priv->pixmap_text) g_free(priv->pixmap_text); |
272 priv->resize_height = 0; | 272 priv->pixmap_text = NULL; |
273 if (priv->pixmap_text) g_free(priv->pixmap_text); | 273 priv->offset = 0; |
274 priv->pixmap_text = NULL; | 274 gtk_widget_set_size_request(widget, textbox->width, textbox->height); |
275 priv->offset = 0; | 275 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
276 gtk_widget_queue_draw(GTK_WIDGET(textbox)); | 276 } |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 static gboolean ui_skinned_textbox_expose(GtkWidget *widget, GdkEventExpose *event) { | 280 static gboolean ui_skinned_textbox_expose(GtkWidget *widget, GdkEventExpose *event) { |
281 g_return_val_if_fail (widget != NULL, FALSE); | 281 g_return_val_if_fail (widget != NULL, FALSE); |
429 } | 429 } |
430 | 430 |
431 static void ui_skinned_textbox_redraw(UiSkinnedTextbox *textbox) { | 431 static void ui_skinned_textbox_redraw(UiSkinnedTextbox *textbox) { |
432 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); | 432 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); |
433 | 433 |
434 if (priv->resize_width || priv->resize_height) | 434 if (priv->resize_width) |
435 gtk_widget_set_size_request(GTK_WIDGET(textbox), | 435 gtk_widget_set_size_request(GTK_WIDGET(textbox), |
436 (textbox->width+priv->resize_width)*(1+priv->double_size), | 436 (textbox->width+priv->resize_width)*(1+priv->double_size), |
437 (textbox->height+priv->resize_height)*(1+priv->double_size)); | 437 (textbox->height)*(1+priv->double_size)); |
438 if (priv->move_x || priv->move_y) | 438 if (priv->move_x || priv->move_y) |
439 gtk_fixed_move(GTK_FIXED(priv->fixed), GTK_WIDGET(textbox), textbox->x+priv->move_x, textbox->y+priv->move_y); | 439 gtk_fixed_move(GTK_FIXED(priv->fixed), GTK_WIDGET(textbox), textbox->x+priv->move_x, textbox->y+priv->move_y); |
440 | 440 |
441 gtk_widget_queue_draw(GTK_WIDGET(textbox)); | 441 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
442 } | 442 } |
885 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); | 885 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); |
886 priv->move_x += x; | 886 priv->move_x += x; |
887 priv->move_y += y; | 887 priv->move_y += y; |
888 } | 888 } |
889 | 889 |
890 void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w, gint h) { | 890 void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w) { |
891 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); | 891 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); |
892 priv->resize_width += w; | 892 priv->resize_width += w; |
893 priv->resize_height += h; | 893 } |
894 } |