Re: Gtk-- create Pixmaps at startup?





Thanks to  Todd Dukes <tdukes@ibmoto.com> for suggesting
that realize() be called in the init for  the Gtk_Window subclass.

Code fragments for displaying and switching pixmaps follow:

class gtk_test_007
  class top_window : public Gtk_Window
    Gdk_Bitmap  sk_mask;
    Gdk_Pixmap  pm_1a;
    Gdk_Pixmap  pm_1b;
    Gtk_Pixmap d_pm_1;

/* XPM */
static char * d1a_xpm[] = {
"80 80 2 1",

gtk_test_007::top_window::init()
  Gdk_Color  tmp_color;
  realize();

  pm_1a.create_from_xpm_d(get_window(),
			  sk_mask,
			  tmp_color,
			  d1a_xpm);
  pm_1b.create_from_xpm_d(get_window(),
			  sk_mask,
			  tmp_color,
			  d1b_xpm);

  d_pm_1.set(pm_1a,sk_mask);

gtk_test_007::top_window::key_press_handler(GdkEventKey *gek)
  if (ab == 0)
    {
      ab = 1;
      d_pm_1.set(pm_1a,sk_mask);
    }
  else
    {
      ab = 0;
      d_pm_1.set(pm_1b,sk_mask);
    }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]