sensitive state in ComboBox menus

2008-04-27 Thread Carlos Pereira
Hi!

How can I set a row in a combobox menu as insensitive/sensitive
and know the current sensitive state, for:

1) a combo box created with gtk_combo_box_new_text

2) a more general combo box created with a tree model

In option menus, I used:
gtk_widget_set_sensitive (item, FALSE);

but this does not work here, as rows are not widgets anymore...
Many thanks for your help!

Carlos|| 
http://library.gnome.org/devel/gtk/stable/GtkComboBox.html#gtk-combo-box-new-text
|| 
http://library.gnome.org/devel/gtk/stable/GtkComboBox.html#gtk-combo-box-new-text
 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: setting the font of a dialog widget

2008-04-27 Thread jcupitt
On 26/04/2008, Garth's KidStuff [EMAIL PROTECTED] wrote:
 I just now got back to this problem.  Maybe I'm misunderstanding something,
 but it seems that the solution you recommend is solely a solution for
 Gtk::Labels -- not for general widgets.  I can change the font size for
 labels -- but not for other widgets (e.g. CheckButton, RadioButton.).
 That's my issue.

All of the button classes are containers with a single 'display'
widget packed inside. The display widget is usually a label, but it
can be anything (a pixmap, for example, or an hbox with a pixmap and a
couple of labels).

So to use pangomarkup to set the font size, cast the button to GtkBin
and get the child, then use gtk_label_set_markup() to set the label's
font size.

  label = gtk_bin_get_child (GTK_BIN (button))
  gtk_label_set_markup (GTK_LABEL (label), ...)

You can also set the font size from resource files. If you want to set
the size for all labels, that might be a better solution. Pangomarkup
is good if you want to mix font sizes or attributes within a single
label.

See:

http://library.gnome.org/devel/gtk/stable/gtk-Resource-Files.html

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Going fullscreen and back

2008-04-27 Thread Carlos Pereira
Hi there,

The small working code below shows
how my app goes fullscreen and back.

1) Is there a better way of doing this?

2) This code works fine in Enlightenment,
KDE, BlackBox, IceWM, etc. In Gnome and XFCE
it works, but the desktop bars are still visible
(I suppose it should be possible to change this?).

However, in GNOME and only in GNOME, I have to
subtract 1 pixel, on width or height, for this to work.
In other words, if I replace this:

gdk_window_move_resize (window-window,
0, 0, gdk_screen_width (), gdk_screen_height () - 1);

by this:
gdk_window_move_resize (window-window,
0, 0, gdk_screen_width (), gdk_screen_height ());

poor Gnome WM gets confused, indeed goes fullscreen,
but does not come back... :-(

What is the best way to handle this?
going fullscreen is a very useful feature
in many scientific/engineering apps.

Many thanks,
Carlos

*** working code: going fullscreen and back ***
#include gtk/gtk.h
#include gdk/gdkkeysyms.h

int x, y, w, h;

int press_event (GtkWidget *widget, GdkEventKey *event, GtkWidget *window)
{
static int fullscreen = FALSE;

switch (event-keyval)
  {
  case GDK_Escape:
  if (fullscreen == FALSE)
{
gtk_window_get_position (GTK_WINDOW (window), x, y);
gtk_window_get_size (GTK_WINDOW (window), w, h);

gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
gdk_window_raise (window-window);
gdk_window_move_resize (window-window,
0, 0, gdk_screen_width (), gdk_screen_height () - 1);
fullscreen = TRUE;
}
  else
{
gtk_window_set_decorated (GTK_WINDOW (window), TRUE);
gdk_window_move_resize (window-window, x, y, w, h);
fullscreen = FALSE;
}
  }

return FALSE;
}

int main (int argc, char **argv)
{
GtkWidget *window;

gtk_init (argc, argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 200, 200);
g_signal_connect_after (G_OBJECT (window),
key_press_event, G_CALLBACK (press_event), window);
gtk_widget_show (window);

gtk_main ();
return 0;
}

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Going fullscreen and back

2008-04-27 Thread Jim George
Why not use gtk_window_fullscreen? I've only tried it on a Gnome
desktop, it works well.

On Sun, Apr 27, 2008 at 11:37 AM, Carlos Pereira
[EMAIL PROTECTED] wrote:
 Hi there,

  The small working code below shows
  how my app goes fullscreen and back.

  1) Is there a better way of doing this?

  2) This code works fine in Enlightenment,
  KDE, BlackBox, IceWM, etc. In Gnome and XFCE
  it works, but the desktop bars are still visible
  (I suppose it should be possible to change this?).

  However, in GNOME and only in GNOME, I have to
  subtract 1 pixel, on width or height, for this to work.
  In other words, if I replace this:

  gdk_window_move_resize (window-window,
  0, 0, gdk_screen_width (), gdk_screen_height () - 1);

  by this:
  gdk_window_move_resize (window-window,
  0, 0, gdk_screen_width (), gdk_screen_height ());

  poor Gnome WM gets confused, indeed goes fullscreen,
  but does not come back... :-(

  What is the best way to handle this?
  going fullscreen is a very useful feature
  in many scientific/engineering apps.

  Many thanks,
  Carlos

  *** working code: going fullscreen and back ***
  #include gtk/gtk.h
  #include gdk/gdkkeysyms.h

  int x, y, w, h;

  int press_event (GtkWidget *widget, GdkEventKey *event, GtkWidget *window)
  {
  static int fullscreen = FALSE;

  switch (event-keyval)
   {
   case GDK_Escape:
   if (fullscreen == FALSE)
 {
 gtk_window_get_position (GTK_WINDOW (window), x, y);
 gtk_window_get_size (GTK_WINDOW (window), w, h);

 gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
 gdk_window_raise (window-window);
 gdk_window_move_resize (window-window,
 0, 0, gdk_screen_width (), gdk_screen_height () - 1);
 fullscreen = TRUE;
 }
   else
 {
 gtk_window_set_decorated (GTK_WINDOW (window), TRUE);
 gdk_window_move_resize (window-window, x, y, w, h);
 fullscreen = FALSE;
 }
   }

  return FALSE;
  }

  int main (int argc, char **argv)
  {
  GtkWidget *window;

  gtk_init (argc, argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_size_request (window, 200, 200);
  g_signal_connect_after (G_OBJECT (window),
  key_press_event, G_CALLBACK (press_event), window);
  gtk_widget_show (window);

  gtk_main ();
  return 0;
  }

  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Going fullscreen and back

2008-04-27 Thread Carlos Pereira
Jim George, Kevin DeKorte wrote:
 Why not use gtk_window_fullscreen? I've only tried it on a Gnome desktop, it 
 works well.
 Why don't you just use
 gtk_window_fullscreen  / gtk_window_unfullscreen?
   
Jim, Kevin, Thanks!

It works fantastically well, I just tried it on GNOME, XFCE, KDE, 
Enlightenment, Blackbox, IceWM, always with correct results.

Moreover, is is much faster than my version and all the annoying
flashing effects are gone!

Thanks!
Carlos
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: inserting model in a GtkTreeStore

2008-04-27 Thread Lance Dillon


- Original Message 
From: Carlos Pereira [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Sunday, April 27, 2008 12:10:27 PM
Subject: inserting model in a GtkTreeStore

Hi all!

To insert the various nodes in a GtkTreeStore, the code below works for me.
The problem is, this should not work, because I am handling a
GtkTreeIter as if it was some sort of integer, while it is in fact a 
structure!

The current child node is the next parent node, so I would expect the 
proper
way to do this would be to copy the current node iter to the parent 
iter, and
because these are structures, I would have to copy their contents...

What is the standard way of doing this? I am confused!

Thanks!
Carlos

GtkTreeIter insert_row (GtkTreeStore *store, GtkTreeIter *parent, char 
*label)
{
GtkTreeIter iter;

gtk_tree_store_append (store, iter, parent);
gtk_tree_store_set (store, iter, 0, label, -1);

return iter;
}

void insert_model (GtkWidget *treeview)
{
GtkTreeStore *store;
GtkTreeIter iter1, iter2, iter3;

store = gtk_tree_store_new (1, G_TYPE_STRING);
iter1 = insert_row (store, NULL, Node 0);
iter2 = insert_row (store, iter1, Node 0:0);
insert_row (store, iter2, Node 0:0:0);
insert_row (store, iter2, Node 0:0:1);
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
g_object_unref (store);
}


---

I believe this is copying the struct (which is allowed as of c99 or something, 
I believe).  Now, if you leave the function and try to use one of the copied 
structs, it probably won't work, becuase these iters were allocated on the 
stack, and will have been freed.  You can do that only if you only will use the 
iter in the current function, otherwise you'll want to use it as a pointer 
instead.






  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re:Rearrange childes of VBOX

2008-04-27 Thread Chandra Shekhar Sengupta
For changing the position of a child in the vbox you can use the api
gtk_box_reorder_child ().Refer the following link
http://library.gnome.org/devel/gtk/stable/GtkBox.html#gtk-box-reorder-child.

Regards,
Chandra Shekhar Sengupta

Message: 1
Date: Fri, 25 Apr 2008 19:46:30 +0400
From: AlannY [EMAIL PROTECTED]
Subject: Rearrange childes of VBOX
To: gtk-app-devel-list@gnome.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=KOI8-R; format=flowed

Hi there ;-)

I have a window with included vbox, which includes some count of
widgets. When I press button, I want to change position of this widgets
in this vbox ;-) How to do it?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re:Re: setting the font of a dialog widget

2008-04-27 Thread Chandra Shekhar Sengupta
hi ,
you can change the font size of a general widget from rc file. Refer the
following code.
///
style dialogstyle = default
{
  font_name = Sans 20
}

widget_class *Dialog* style dialogstyle


Include the above code to rc file . It works.

Regards,
Chandra Shekhar Sengupta

Date: Sat, 26 Apr 2008 10:10:45 -0700
From: Garth's KidStuff [EMAIL PROTECTED]
Subject: Re: setting the font of a dialog widget
To: gtk-app-devel-list@gnome.org, [EMAIL PROTECTED]
Message-ID:
   [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

Hey there,

I just now got back to this problem.  Maybe I'm misunderstanding something,
but it seems that the solution you recommend is solely a solution for
Gtk::Labels -- not for general widgets.  I can change the font size for
labels -- but not for other widgets (e.g. CheckButton, RadioButton.).
That's my issue.

To recap:  How do I change the font size of a general widget?

Thanks in advance.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list