diff --git a/src/pw3270/uiparser/button.c b/src/pw3270/uiparser/button.c index f0242b8..ae9a0e4 100644 --- a/src/pw3270/uiparser/button.c +++ b/src/pw3270/uiparser/button.c @@ -84,7 +84,7 @@ GtkAction * action = NULL; if(label) { - keypad->widget = gtk_button_new_with_label(label); + keypad->widget = gtk_button_new_with_label(gettext(g_strcompress(label))); } else { gchar *text = g_strconcat("gtk-",icon,NULL); keypad->widget = gtk_button_new(); @@ -92,25 +92,6 @@ g_free(text); } - /* - const gchar * label = ui_get_attribute("label", names, values); - const gchar * icon = ui_get_attribute("icon", names, values); - const gchar * name = ui_get_attribute("action", names, values); - GtkWidget * widget = NULL; - - if(label) - { - widget = gtk_button_new_with_label(gettext(g_strcompress(label))); - } - else if(icon) - { - gchar *text = g_strconcat("gtk-",icon,NULL); - widget = gtk_button_new(); - gtk_container_add(GTK_CONTAINER(widget),gtk_image_new_from_stock(text,GTK_ICON_SIZE_SMALL_TOOLBAR)); - g_free(text); - } -*/ - #if GTK_CHECK_VERSION(2,18,0) gtk_widget_set_can_focus(keypad->widget,FALSE); gtk_widget_set_can_default(keypad->widget,FALSE); diff --git a/src/pw3270/uiparser/keypad.c b/src/pw3270/uiparser/keypad.c index f8f0706..d3195db 100644 --- a/src/pw3270/uiparser/keypad.c +++ b/src/pw3270/uiparser/keypad.c @@ -28,11 +28,15 @@ */ #include "keypad.h" + #include /*--[ Implement ]------------------------------------------------------------------------------------*/ static void element_start(GMarkupParseContext *context, const gchar *element_name, const gchar **names,const gchar **values, struct keypad *keypad, GError **error) { + int width = 1; + int height = 1; + trace("%s(%s,%d,%d)",__FUNCTION__,element_name,(int) keypad->row, (int) keypad->col); keypad->widget = NULL; @@ -41,24 +45,45 @@ keypad_button_start(context, names, values, error, keypad); } - } - - static void element_end(GMarkupParseContext *context, const gchar *element_name, struct keypad *keypad, GError **error) - { if(keypad->widget) { - gtk_grid_attach(keypad->grid,keypad->widget,keypad->col,keypad->row,1,1); + + // Criou widget, incluir + const gchar * tmp; + + tmp = ui_get_attribute("width", names, values); + if(tmp) { + width = atoi(tmp); + } + + tmp = ui_get_attribute("height", names, values); + if(tmp) { + height = atoi(tmp); + } + + tmp = ui_get_attribute("column", names, values); + if(tmp) { + keypad->col = atoi(tmp); + } + + gtk_grid_attach(keypad->grid,keypad->widget,keypad->col,keypad->row,width,height); keypad->widget = NULL; + } if(!strcasecmp(element_name,"row")) { keypad->row++; keypad->col = 0; } else { - keypad->col++; + keypad->col += width; } } + static void element_end(GMarkupParseContext *context, const gchar *element_name, struct keypad *keypad, GError **error) + { + + } + static void toggled(GtkToggleAction *action, GtkWidget *widget) { gboolean active = gtk_toggle_action_get_active(action); @@ -145,7 +170,7 @@ keypad->relief = ui_get_relief(names, values, GTK_RELIEF_NORMAL); keypad->grid = GTK_GRID(gtk_grid_new()); - gtk_grid_set_row_homogeneous(keypad->grid,TRUE); + // gtk_grid_set_row_homogeneous(keypad->grid,TRUE); gtk_grid_set_column_homogeneous(keypad->grid,TRUE); g_object_set_data(G_OBJECT(keypad->grid),"position",(gpointer) keypad->pos); diff --git a/ui/10keypad.xml b/ui/10keypad.xml index 4dfd025..805ff01 100644 --- a/ui/10keypad.xml +++ b/ui/10keypad.xml @@ -34,64 +34,60 @@ -