From 5d2c2b27a6323e2666378b986129b2a7c2c39e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Feb 2022 16:04:24 +0100 Subject: New upstream version 5.2.2GA --- app/wlib/gtklib/control.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'app/wlib/gtklib/control.c') diff --git a/app/wlib/gtklib/control.c b/app/wlib/gtklib/control.c index 07d9210..0332470 100644 --- a/app/wlib/gtklib/control.c +++ b/app/wlib/gtklib/control.c @@ -89,7 +89,17 @@ void wControlActive( abort(); } - gtk_widget_set_sensitive(GTK_WIDGET(b->widget), active); + if (b->type == B_LIST || b->type == B_DROPLIST ) { + + gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(b->widget)), active); + gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(b->widget), + active?GTK_SENSITIVITY_ON:GTK_SENSITIVITY_OFF); + + } else { + + gtk_widget_set_sensitive(GTK_WIDGET(b->widget), active); + + } } /** @@ -102,7 +112,7 @@ void wControlActive( * \returns width of label including some space */ -wPos_t wLabelWidth( +wWinPix_t wLabelWidth( const char * label) { GtkWidget * widget; @@ -122,7 +132,7 @@ wPos_t wLabelWidth( * \returns width */ -wPos_t wControlGetWidth( +wWinPix_t wControlGetWidth( wControl_p b) { return b->w; @@ -135,7 +145,7 @@ wPos_t wControlGetWidth( * \returns height */ -wPos_t wControlGetHeight( +wWinPix_t wControlGetHeight( wControl_p b) { return b->h; @@ -148,7 +158,7 @@ wPos_t wControlGetHeight( * \returns position */ -wPos_t wControlGetPosX( +wWinPix_t wControlGetPosX( wControl_p b) /* Control */ { return b->realX; @@ -161,7 +171,7 @@ wPos_t wControlGetPosX( * \returns position */ -wPos_t wControlGetPosY( +wWinPix_t wControlGetPosY( wControl_p b) /* Control */ { return b->realY - BORDERSIZE - ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0); @@ -177,8 +187,8 @@ wPos_t wControlGetPosY( void wControlSetPos( wControl_p b, - wPos_t x, - wPos_t y) + wWinPix_t x, + wWinPix_t y) { b->realX = x; b->realY = y + BORDERSIZE + ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0); @@ -306,19 +316,12 @@ void wControlHilite( { cairo_t *cr; int off = GTKCONTROLHILITEWIDTH/2+1; + if ( debugWindow >= 1 ) + printf( "wControlHIlite( %s, %d )\n", b->labelStr, hilite ); if (b->widget == NULL) { return; } - - if (! gtk_widget_get_visible(b->widget)) { - return; - } - - if (! gtk_widget_get_visible(b->parent->widget)) { - return; - } - b->outline = hilite; if (b->widget) -- cgit v1.2.3 From a14a7a0ccc9de76aeab0b2e4bbf58f1a79deedc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 3 Jul 2024 10:19:30 +0200 Subject: New upstream version 5.3.0GA --- app/wlib/gtklib/control.c | 248 +++++++++++++++++++++++----------------------- 1 file changed, 122 insertions(+), 126 deletions(-) (limited to 'app/wlib/gtklib/control.c') diff --git a/app/wlib/gtklib/control.c b/app/wlib/gtklib/control.c index 0332470..d43d2b6 100644 --- a/app/wlib/gtklib/control.c +++ b/app/wlib/gtklib/control.c @@ -1,7 +1,7 @@ /** \file control.c * Control Utilities */ -/* +/* * Copyright 2016 Martin Fischer * * This program is free software; you can redistribute it and/or modify @@ -46,31 +46,31 @@ */ void wControlShow( - wControl_p b, - wBool_t show) + wControl_p b, + wBool_t show) { - if (b->type == B_LINES) { - wlibLineShow((wLine_p)b, show); - return; - } - - if (b->widget == NULL) { - abort(); - } - - if (show) { - gtk_widget_show(b->widget); - - if (b->label) { - gtk_widget_show(b->label); - } - } else { - gtk_widget_hide(b->widget); - - if (b->label) { - gtk_widget_hide(b->label); - } - } + if (b->type == B_LINES) { + wlibLineShow((wLine_p)b, show); + return; + } + + if (b->widget == NULL) { + abort(); + } + + if (show) { + gtk_widget_show(b->widget); + + if (b->label) { + gtk_widget_show(b->label); + } + } else { + gtk_widget_hide(b->widget); + + if (b->label) { + gtk_widget_hide(b->label); + } + } } /** @@ -82,24 +82,24 @@ void wControlShow( */ void wControlActive( - wControl_p b, - int active) + wControl_p b, + int active) { - if (b->widget == NULL) { - abort(); - } + if (b->widget == NULL) { + abort(); + } - if (b->type == B_LIST || b->type == B_DROPLIST ) { + if (b->type == B_LIST || b->type == B_DROPLIST ) { - gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(b->widget)), active); - gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(b->widget), - active?GTK_SENSITIVITY_ON:GTK_SENSITIVITY_OFF); + gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(b->widget)), active); + gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(b->widget), + active?GTK_SENSITIVITY_ON:GTK_SENSITIVITY_OFF); - } else { + } else { - gtk_widget_set_sensitive(GTK_WIDGET(b->widget), active); + gtk_widget_set_sensitive(GTK_WIDGET(b->widget), active); - } + } } /** @@ -113,16 +113,16 @@ void wControlActive( */ wWinPix_t wLabelWidth( - const char * label) + const char * label) { - GtkWidget * widget; - GtkRequisition requisition; - widget = gtk_label_new(wlibConvertInput(label)); - gtk_widget_size_request(widget, &requisition); - g_object_ref_sink (widget); - gtk_widget_destroy(widget); - g_object_unref(widget); - return requisition.width+8; + GtkWidget * widget; + GtkRequisition requisition; + widget = gtk_label_new(wlibConvertInput(label)); + gtk_widget_size_request(widget, &requisition); + g_object_ref_sink (widget); + gtk_widget_destroy(widget); + g_object_unref(widget); + return requisition.width+8; } /** @@ -133,9 +133,9 @@ wWinPix_t wLabelWidth( */ wWinPix_t wControlGetWidth( - wControl_p b) + wControl_p b) { - return b->w; + return b->w; } /** @@ -146,9 +146,9 @@ wWinPix_t wControlGetWidth( */ wWinPix_t wControlGetHeight( - wControl_p b) + wControl_p b) { - return b->h; + return b->h; } /** @@ -159,9 +159,9 @@ wWinPix_t wControlGetHeight( */ wWinPix_t wControlGetPosX( - wControl_p b) /* Control */ + wControl_p b) /* Control */ { - return b->realX; + return b->realX; } /** @@ -172,9 +172,10 @@ wWinPix_t wControlGetPosX( */ wWinPix_t wControlGetPosY( - wControl_p b) /* Control */ + wControl_p b) /* Control */ { - return b->realY - BORDERSIZE - ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0); + return b->realY - BORDERSIZE - ((b->parent->option&F_MENUBAR) + ?b->parent->menu_height:0); } /** @@ -186,27 +187,29 @@ wWinPix_t wControlGetPosY( */ void wControlSetPos( - wControl_p b, - wWinPix_t x, - wWinPix_t y) + wControl_p b, + wWinPix_t x, + wWinPix_t y) { - b->realX = x; - b->realY = y + BORDERSIZE + ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0); - - if (b->widget) { - gtk_fixed_move(GTK_FIXED(b->parent->widget), b->widget, b->realX, b->realY); - } - - if (b->label) { - GtkRequisition requisition, reqwidget; - gtk_widget_size_request(b->label, &requisition); - if (b->widget) - gtk_widget_size_request(b->widget, &reqwidget); - else - reqwidget.height = requisition.height; - gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW, - b->realY+(reqwidget.height/2 - requisition.height/2)); - } + b->realX = x; + b->realY = y + BORDERSIZE + ((b->parent->option&F_MENUBAR) + ?b->parent->menu_height:0); + + if (b->widget) { + gtk_fixed_move(GTK_FIXED(b->parent->widget), b->widget, b->realX, b->realY); + } + + if (b->label) { + GtkRequisition requisition, reqwidget; + gtk_widget_size_request(b->label, &requisition); + if (b->widget) { + gtk_widget_size_request(b->widget, &reqwidget); + } else { + reqwidget.height = requisition.height; + } + gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW, + b->realY+(reqwidget.height/2 - requisition.height/2)); + } } /** @@ -217,24 +220,25 @@ void wControlSetPos( */ void wControlSetLabel( - wControl_p b, - const char * labelStr) + wControl_p b, + const char * labelStr) { - GtkRequisition requisition,reqwidget; - - if (b->label) { - gtk_label_set_text(GTK_LABEL(b->label), wlibConvertInput(labelStr)); - gtk_widget_size_request(b->label, &requisition); - if (b->widget) - gtk_widget_size_request(b->widget, &reqwidget); - else - reqwidget.height = requisition.height; - b->labelW = requisition.width+8; - gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW, - b->realY+(reqwidget.height/2 - requisition.height/2)); - } else { - b->labelW = wlibAddLabel(b, labelStr); - } + GtkRequisition requisition,reqwidget; + + if (b->label) { + gtk_label_set_text(GTK_LABEL(b->label), wlibConvertInput(labelStr)); + gtk_widget_size_request(b->label, &requisition); + if (b->widget) { + gtk_widget_size_request(b->widget, &reqwidget); + } else { + reqwidget.height = requisition.height; + } + b->labelW = requisition.width+8; + gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW, + b->realY+(reqwidget.height/2 - requisition.height/2)); + } else { + b->labelW = wlibAddLabel(b, labelStr); + } } /** @@ -245,10 +249,10 @@ void wControlSetLabel( */ void wControlSetContext( - wControl_p b, - void * context) + wControl_p b, + void * context) { - b->data = context; + b->data = context; } /** @@ -258,31 +262,21 @@ void wControlSetContext( */ void wControlSetFocus( - wControl_p b) + wControl_p b) { } wBool_t wControlExpose ( - GtkWidget * widget, - GdkEventExpose * event, - wControl_p b - ) + GtkWidget * widget, + GdkEventExpose * event, + wControl_p b +) { GdkWindow * win = gtk_widget_get_window(b->widget); cairo_t * cr = NULL; if (win) { cr = gdk_cairo_create(win); - } else return TRUE; - -#ifdef CURSOR_SURFACE - if (b && b->cursor_surface.surface && b->cursor_surface.show) { - cairo_set_source_surface(cr,b->cursor_surface.surface,event->area.x, event->area.y); - cairo_set_operator(cr,CAIRO_OPERATOR_OVER); - cairo_rectangle(cr,event->area.x, event->area.y, - event->area.width, event->area.height); - cairo_fill(cr); - } -#endif + } else { return TRUE; } if (b->outline) { cairo_set_source_rgb(cr, 0.23, 0.37, 0.80); @@ -291,7 +285,7 @@ wBool_t wControlExpose ( cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); cairo_set_line_join(cr, CAIRO_LINE_JOIN_MITER); cairo_rectangle(cr,event->area.x+2, event->area.y+2, - event->area.width-4, event->area.height-4); + event->area.width-4, event->area.height-4); cairo_stroke(cr); } @@ -299,7 +293,7 @@ wBool_t wControlExpose ( cairo_destroy(cr); - return FALSE; + return FALSE; } /** @@ -311,19 +305,21 @@ wBool_t wControlExpose ( * */ void wControlHilite( - wControl_p b, - wBool_t hilite) + wControl_p b, + wBool_t hilite) { - cairo_t *cr; - int off = GTKCONTROLHILITEWIDTH/2+1; - if ( debugWindow >= 1 ) - printf( "wControlHIlite( %s, %d )\n", b->labelStr, hilite ); - - if (b->widget == NULL) { - return; - } - b->outline = hilite; - - if (b->widget) - gtk_widget_queue_draw(b->widget); +// cairo_t *cr; +// int off = GTKCONTROLHILITEWIDTH/2+1; + if ( debugWindow >= 1 ) { + printf( "wControlHIlite( %s, %d )\n", b->labelStr, hilite ); + } + + if (b->widget == NULL) { + return; + } + b->outline = hilite; + + if (b->widget) { + gtk_widget_queue_draw(b->widget); + } } -- cgit v1.2.3