summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/control.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2024-07-03 10:19:30 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2024-07-03 10:19:30 +0200
commita14a7a0ccc9de76aeab0b2e4bbf58f1a79deedc2 (patch)
treee469179df67a0e0db49161a43cbf8076a189f6f4 /app/wlib/gtklib/control.c
parent5d2c2b27a6323e2666378b986129b2a7c2c39e5c (diff)
New upstream version 5.3.0GAupstream/5.3.0GAupstream
Diffstat (limited to 'app/wlib/gtklib/control.c')
-rw-r--r--app/wlib/gtklib/control.c248
1 files changed, 122 insertions, 126 deletions
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 <m_fischer@sf.net>
*
* 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);
+ }
}