In the POPUP MENU and COMBOBOX ........... has these effects
.......................
If you activate a combo-box or menu ..........and then you clicked
the button maximize or minimize of the window ........ ...
this always happens
1). First .Clicking the maximize or minimize button of the window ...
. The COMBO-BOX is disabled ........... and her menu option .
2)Second . Then recently . I can close the window.
this always happens
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
View Example
///////////////////////////////////////////////////////////////////////////////////////////////////////////
/*******THE CODE********/
#include <gtk/gtk.h>
int main(int argc,
char *argv[]) {
GtkWidget *window;
GtkWidget *combo;
GtkWidget *widget;
GtkWidget *vbox;
GtkWidget *hbox;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "BibMk");
gtk_container_set_border_width(GTK_CONTAINER(window), 20);
g_signal_connect(window, "delete-event",
G_CALLBACK(gtk_main_quit), NULL);
vbox = gtk_vbox_new(FALSE, 0);
hbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), hbox);
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(combo), NULL, " Loco ");
gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT(combo) , " Book
");
gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT(combo) , "
Ladron ");
gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT(combo) , "
Anibal Bigoton ");
gtk_widget_show(combo);
gtk_box_pack_start(GTK_BOX(hbox), combo, TRUE, TRUE, 0);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
/*******CODE END**********/
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I am creating a combo-box with scrollbar with GTK 3.0 and VALA (gtk)
......... .as the COMBO-BOX in LibreOffice that have in the list of
FONTS.
I wrote an in GTK 3.0 widgets.
If . I active a POPUP WINDOW (POPUP WINDOW=MENU ) with a
TOGGLEBUTTON... when you clicked the button to close the window.
1). First . The TOGGLEBUTTON is off . the POPUP WINDOW is
hidden .
2) Then recently . I can close the window.
To here all works fine.
But I can not do the same with the buttons on the maximize and minimize
WINDOW ...... I must achieve the same effect as the widgets , POPUP MENU
and COMBO-BOX , with these events .
If I you can help , I'll be grateful .
When , you have a time. you can constestarme.
Best regards . Mariano.
this is the code I've written in GTK 3.0.
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
#include <gtk/gtk.h>
enum
{
LIST_ITEM = 0,
N_COLUMNS
};
static void init_list(GtkWidget *list)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkListStore *store;
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("List Items",
renderer, "text", LIST_ITEM, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(list),
GTK_TREE_MODEL(store));
g_object_unref(store);
}
static void add_to_list(GtkWidget *list, const gchar *str)
{
GtkListStore *store;
GtkTreeIter iter;
store = GTK_LIST_STORE(gtk_tree_view_get_model
(GTK_TREE_VIEW(list)));
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, LIST_ITEM, str, -1);
}
////////////////////////////////////////////////////////////////////////////////
static void text( GtkWidget *widget , GdkEventButton *event, gpointer
buttonf)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(buttonf),FALSE);
}
static void clicked1(GtkWindow *window, GdkEventButton *event, gpointer
buttonf)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(buttonf),FALSE);
}
static void loc1(GtkWindow *window, GdkEventButton *event, gpointer
buttonf)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(buttonf),FALSE);
}
static void ponja2(GtkWindow *window, GdkEventButton *event, gpointer
buttonf)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(buttonf),FALSE);
}
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
void activado(GtkWidget *widget, gpointer window3)
{
if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
{
gtk_widget_hide(window3);
gtk_widget_show_all(window3);
}
else {
gtk_window_iconify (GTK_WINDOW (window3) );
gtk_widget_hide(window3);
}
}
///////////////////////////////////////////////////////////////////////
void ventana_p(GtkWindow *window, GdkEvent *event, gpointer window3 )
{
int x, y;
char buf[10];
x = event->configure.x;
y = event->configure.y;
sprintf(buf, "%d, %d", x, y);
gtk_window_set_title(window3, buf);
gtk_window_move ( GTK_WINDOW(window3), x+30, y+35 );
}
//////////////////////////////////////////////////////////////////////////
int main(int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *vbox1 ;
GtkWidget *vbox2;
GtkWidget *vbox3;
GtkWidget *fixed;
GtkWidget *buttonf;
GtkWidget *label2;
GtkWidget *arrow;
GtkWidget *vboxtext;
GtkWidget *viewarea;
GtkWidget *textview;
GtkTextBuffer *buffer;
GtkWidget *window3;
GtkWidget *vboxw;
GtkWidget *vboxs;
GtkWidget *scrolled_window ;
GtkWidget *list;
GtkTreeSelection *selection;
GtkWidget *label;
gtk_init(&argc, &argv);
////////////////////////////// Ventana Popup / Window Popup
///////////////////////////////
window3 = gtk_window_new(GTK_WINDOW_POPUP);
gtk_window_set_title(GTK_WINDOW(window3), "enter signal");
gtk_widget_hide(window3);
vboxw = gtk_hbox_new(FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vboxw), 3);
gtk_container_add(GTK_CONTAINER(window3), vboxw);
gtk_widget_show (vboxw);
scrolled_window=gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_size_request(scrolled_window,120, 300);
gtk_box_pack_start(GTK_BOX(vboxw), scrolled_window , FALSE, FALSE, 0);
gtk_widget_show(scrolled_window);
vboxs = gtk_vbox_new(FALSE, 0);
gtk_scrolled_window_add_with_viewport(
GTK_SCROLLED_WINDOW(scrolled_window),vboxs);
list = gtk_tree_view_new();
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE);
gtk_box_pack_start(GTK_BOX(vboxs), list, TRUE, TRUE, 0);
init_list(list);
add_to_list(list, "Ubuntu");
add_to_list(list, "Mandriva");
add_to_list(list, "Fedora");
add_to_list(list, "Debian");
add_to_list(list, "Linux MInt");
add_to_list(list, "Tuquito");
add_to_list(list, "Pupix");
add_to_list(list, "Open Suse");
add_to_list(list, "Kubuntu");
add_to_list(list, "Xubuntu");
add_to_list(list, "Trisquel");
add_to_list(list, "Zorin");
add_to_list(list, "Mageia");
add_to_list(list, "Cent OS");
add_to_list(list, "Pardus");
add_to_list(list, "Sabayon");
add_to_list(list, "Dragora");
add_to_list(list, "Goblin");
add_to_list(list, "Linex");
add_to_list(list, "Pro-linux");
add_to_list(list, "Red Hat");
////////////////////////////////////////////////////////////////////////
///////////////////////// Ventana Principal //////////////////////
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
gtk_window_set_title(GTK_WINDOW(window), "Simple");
gtk_window_set_transient_for(GTK_WINDOW (window3),GTK_WINDOW
(window));
gtk_widget_add_events(GTK_WIDGET(window), GDK_BUTTON_PRESS_MASK );
gtk_widget_add_events(GTK_WIDGET(window),GDK_CONFIGURE );
gtk_widget_add_events(GTK_WIDGET(window),GDK_FOCUS_CHANGE_MASK );
gtk_widget_grab_focus (window);
vbox1 =gtk_vbox_new(FALSE, 0);
gtk_widget_show_all(vbox1);
gtk_container_add(GTK_CONTAINER(window), vbox1);
vbox2 = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox1), vbox2 , FALSE, FALSE, 0);
fixed = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(vbox2), fixed);
buttonf = gtk_toggle_button_new();
gtk_widget_set_size_request(buttonf, 128, 35);
gtk_fixed_put(GTK_FIXED(fixed), buttonf, 29, 0);
vbox3 =gtk_hbox_new(FALSE, 0);
label2 = gtk_label_new("Buttonf");
gtk_box_pack_start(GTK_BOX(vbox3),label2,TRUE,TRUE,2);
gtk_container_add(GTK_CONTAINER(buttonf), vbox3);
gtk_widget_show(label2);
arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN );
gtk_box_pack_start(GTK_BOX(vbox3),arrow,FALSE,FALSE,2);
////////////////////////////// TEXTO
///////////////////////////////////////////////
vboxtext = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(vbox1), vboxtext);
gtk_widget_set_size_request(vboxtext, 300, 300);
viewarea=gtk_scrolled_window_new(NULL,NULL);
gtk_box_pack_start(GTK_BOX(vboxtext),viewarea,TRUE,TRUE,0);
gtk_widget_show(viewarea);
gtk_widget_add_events(GTK_WIDGET(textview), GDK_BUTTON_PRESS_MASK );
textview = gtk_text_view_new();
gtk_container_set_border_width(GTK_CONTAINER( textview), 0);
gtk_container_add(GTK_CONTAINER(viewarea), textview);
gtk_container_set_border_width(GTK_CONTAINER(viewarea), 2);
gtk_widget_grab_focus( textview);
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW( textview));
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////// llamada de ventana
////////////////////////////////
g_signal_connect_swapped(window, "destroy",G_CALLBACK(gtk_main_quit),
window);
//////////////////////// toggle button llamadas /////////////////////
g_signal_connect(G_OBJECT(window), "configure-event",
G_CALLBACK(ventana_p),window3);
g_signal_connect(buttonf, "toggled", G_CALLBACK(activado), window3);
g_signal_connect(G_OBJECT(window), "button-press-event",
G_CALLBACK(ponja2), buttonf);
g_signal_connect(G_OBJECT(window), "focus-out-event",
G_CALLBACK(loc1), buttonf );
g_signal_connect (window, "delete_event", G_CALLBACK (clicked1),
buttonf);
g_signal_connect(G_OBJECT(textview), "button-press-event",
G_CALLBACK(text), buttonf);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
2012/6/22 Tadej BorovÅak <tadeboro gmail com>
Hello.
Hello ........How I can make the buttons are inactive , the buttons
of
the window (Buttons : maximize , minimize , close ) or without focus
when
the pointer is over them ? ................
I need to get the effect . Caso 2 . View image
http://fotos.subefotos.com/607c3fb8e19de4ed18357b85a33b3ab5o.png
This is not something you could do with GTK+, since window decorations
are usually handled by window manager. What window manager (desktop) are
you using? Maybe it can be themed to behave this way?
Cheers,
Tadej
--
Tadej BorovÅak
tadej borovsak gmail com
tadeboro gmail com
tadeboro.blogspot.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list