Example #1
0
static void board_resized(void)
{
	GtkWidget *widget = g_object_get_data(G_OBJECT(main_win),
					      "drawingarea");
	int w = widget->allocation.width, h = widget->allocation.height;

	if (rvr_buf) {
		g_object_unref(rvr_buf);
		g_object_unref(blackpiece);
		g_object_unref(whitepiece);
		g_object_unref(mydot);
		g_object_unref(enemydot);
	}

	gtk_widget_realize(widget);
	rvr_buf = gdk_pixmap_new(widget->window, w, h, -1);
	gdk_draw_rectangle(rvr_buf, widget->style->black_gc, TRUE,
			   0, 0, w, h);

	PIXSIZE = MIN(w, h) / 8;

	/* Create the white piece, black piece, and dot images. */
	blackpiece = load_pixmap("black");
	whitepiece = load_pixmap("white");
	mydot = load_pixmap("dot");
	enemydot = load_pixmap("enemydot");

	draw_bg(widget);
	display_board();
}
Example #2
0
/*! 
  Reads the registry to determine the location of the main window, and whether
  or not to display the splash screen.  If so, it shows the GraspIt! logo
  splash screen in the center of the screen.
 */
void
GraspItApp::showSplash()
{
    QRect screen = QApplication::desktop()->screenGeometry();
    QSettings config;
    config.insertSearchPath( QSettings::Windows, "/Columbia" );

    QRect mainRect;
    QString keybase = "/GraspIt/0.9/";
    bool show = config.readBoolEntry( keybase + "SplashScreen", TRUE );
    mainRect.setX( config.readNumEntry( keybase + "Geometries/MainwindowX", 0 ) );
    mainRect.setY( config.readNumEntry( keybase + "Geometries/MainwindowY", 0 ) );
    mainRect.setWidth( config.readNumEntry( keybase + "Geometries/MainwindowWidth", 500 ) );
    mainRect.setHeight( config.readNumEntry( keybase + "Geometries/MainwindowHeight", 500 ) );
    screen = QApplication::desktop()->screenGeometry( QApplication::desktop()->screenNumber( mainRect.center() ) );

    if ( show ) {
		splash = new QLabel( 0, "splash",Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
	// WStyle_Customize | WStyle_StaysOnTop
	splash->setAttribute(Qt::WA_DeleteOnClose,true);
	splash->setFrameStyle( QFrame::WinPanel | QFrame::Raised );
	splash->setPixmap(load_pixmap( "splash.jpg" ));
	splash->adjustSize();
	splash->setFixedSize(splash->sizeHint());
	splash->setCaption( "GraspIt!" );
	splash->move( screen.center() - QPoint( splash->width() / 2, splash->height() / 2 ) );
	splash->show();
	splash->repaint( FALSE );
	QApplication::flush();
	//	set_splash_status( "Initializing..." );
    }
}
Example #3
0
File: dialogs.c Project: aufau/xqf
void about_dialog (GtkWidget *widget, gpointer data) {
	GtkWidget* aboutwindow = NULL;
	GtkWidget* w = NULL, *w2 = NULL;
	char *intro = _("XQF Game Server Browser");
	char *version = g_strdup_printf(_("Version %s"),XQF_VERSION);

	/* translators can use the copyright symbol instead of (C) */
	char *author = _("Copyright (C) 1998-2002 Roman Pozlevich");
	char *urls = "http://www.linuxgames.com/xqf\n"
		"http://sourceforge.net/projects/xqf\n";
	char *contrib1 = _("Maintainers:");
	char *contrib2 =
		"Thomas Debesse <*****@*****.**>\n"
		"Ludwig Nussel <*****@*****.**>\n"
		"Alex Burger <*****@*****.**>\n"
		"Jordi Mallach <*****@*****.**>\n"
		"Bill Adams <*****@*****.**>\n";
	char *contrib3 = _("Contributors:");
	char *contrib4 = 
		"Jochen Baier <*****@*****.**>\n"
		"Luca Camillo <*****@*****.**>\n";
	char *bugs1 = _("Bug reports and feature requests:");
	char *bugs2 = "http://sourceforge.net/projects/xqf\n"
		"[email protected]\n";

	char *text = NULL;//  dialog_ok (_("About XQF"), "%s", text);
	aboutwindow = create_AboutWindow();

	w2 = load_pixmap(aboutwindow, "splash.png");

	w = gtk_object_get_data(GTK_OBJECT(aboutwindow),"AboutVBox");
	gtk_box_pack_start (GTK_BOX (w), w2, FALSE, FALSE, 0);
	gtk_box_reorder_child(GTK_BOX(w), w2, 0);
	gtk_widget_show(w2);

	w = gtk_object_get_data(GTK_OBJECT(aboutwindow),"AboutLabel");

	text = g_strjoin("\n", intro, version, author, urls, contrib1, contrib2,
			contrib3, contrib4, bugs1, bugs2, NULL);
	g_free(version);

	gtk_label_set_text(GTK_LABEL(w), text);

	g_free(text);

	gtk_window_set_transient_for (GTK_WINDOW (aboutwindow), GTK_WINDOW (top_window()));

	register_window(aboutwindow);

	gtk_widget_show(aboutwindow);
}
Example #4
0
int
main(int argc, char **argv)
{
	int COLS, ROWS;

	if (GrOpen() == -1)
		exit(1);

	COLS = 480;
	ROWS = 300;

	load_pixmap();

	g_main = GrNewWindowEx(GR_WM_PROPS_APPWINDOW, "tsdemo",
		    GR_ROOT_WINDOW_ID, 100, 50, COLS - 120, ROWS - 60, GRAY);

	GrSelectEvents(g_main,
		       GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ);
	GrMapWindow(g_main);

	while (1) {
		GR_EVENT event;

		GrGetNextEvent(&event);

		switch (event.type) {
		case GR_EVENT_TYPE_EXPOSURE:
			g_x = 5;
			draw_set("GR_FILL_STIPPLE", GR_FILL_STIPPLE);
			draw_set("GR_FILL_OPAQUE_STIPPLE", GR_FILL_OPAQUE_STIPPLE);
			draw_set("GR_FILL_TILE", GR_FILL_TILE);
			break;

		case GR_EVENT_TYPE_CLOSE_REQ:
			GrClose();
			exit(0);
		}
	}
}
Example #5
0
Boolean Xvars::load_pixmap(Drawable* pixmap,Drawable* mask,
                           int dpyNum,char** xpmBits) {
  return load_pixmap(pixmap,mask,dpyNum,xpmBits,is_stretched());
}
Example #6
0
void
pixmaps_init (void)
{
	pix_book = gdk_pixbuf_new_from_inline (-1, bookpng, FALSE, 0);

	/* used in About window, tray icon and WindowManager icon. */
	pix_xchat = load_pixmap ("hexchat", hexchatpng, 1);

	/* userlist icons, with inlined defaults */
	pix_hop = load_pixmap ("hop", hoppng, 1);
	pix_purple = load_pixmap ("purple", purplepng, 1);
	pix_red = load_pixmap ("red", redpng, 1);
	pix_op = load_pixmap ("op", oppng, 1);
	pix_voice = load_pixmap ("voice", voicepng, 1);

	/* tray icons, with inlined defaults */
	pix_tray_msg = load_pixmap ("message", traymsgpng, 1);
	pix_tray_hilight = load_pixmap ("highlight", trayhilightpng, 1);
	pix_tray_file = load_pixmap ("fileoffer", trayfilepng, 1);

	/* treeview icons, no defaults, load from disk only */
	pix_channel = load_pixmap ("channel", NULL, 0);
	pix_dialog = load_pixmap ("dialog", NULL, 0);
	pix_server = load_pixmap ("server", NULL, 0);
	pix_util = load_pixmap ("util", NULL, 0);
}
Example #7
0
void
pixmaps_init (void)
{
	pix_ulist_voice = load_pixmap ("ulist_voice");
	pix_ulist_halfop = load_pixmap ("ulist_halfop");
	pix_ulist_op = load_pixmap ("ulist_op");
	pix_ulist_owner = load_pixmap ("ulist_owner");
	pix_ulist_founder = load_pixmap ("ulist_founder");
	pix_ulist_netop = load_pixmap ("ulist_netop");

	pix_tray_fileoffer = load_pixmap ("tray_fileoffer");
	pix_tray_highlight = load_pixmap ("tray_highlight");
	pix_tray_message = load_pixmap ("tray_message");

	pix_tree_channel = load_pixmap ("tree_channel");
	pix_tree_dialog = load_pixmap ("tree_dialog");
	pix_tree_server = load_pixmap ("tree_server");
	pix_tree_util = load_pixmap ("tree_util");

	/* non-replaceable book pixmap */
	pix_book = gdk_pixbuf_new_from_resource ("/icons/book.png", NULL);

	/* used in About window, tray icon and WindowManager icon. */
	pix_xchat = load_pixmap ("pchat");
}
Example #8
0
void
pixmaps_init (void)
{
	/* userlist icons, with inlined defaults */
	pix_ulist_voice = load_pixmap ("ulist_voice", png_ulist_voice, 1);
	pix_ulist_halfop = load_pixmap ("ulist_halfop", png_ulist_halfop, 1);
	pix_ulist_op = load_pixmap ("ulist_op", png_ulist_op, 1);
	pix_ulist_owner = load_pixmap ("ulist_owner", png_ulist_owner, 1);
	pix_ulist_founder = load_pixmap ("ulist_founder", png_ulist_founder, 1);
	pix_ulist_netop = load_pixmap ("ulist_netop", png_ulist_netop, 1);

	/* tray icons, with inlined defaults */
	pix_tray_fileoffer = load_pixmap ("tray_fileoffer", png_tray_fileoffer, 1);
	pix_tray_highlight = load_pixmap ("tray_highlight", png_tray_highlight, 1);
	pix_tray_message = load_pixmap ("tray_message", png_tray_message, 1);

#if 0
	/* treeview icons, no defaults, load from disk only */
	pix_tree_channel = load_pixmap ("tree_channel", NULL, 0);
	pix_tree_dialog = load_pixmap ("tree_dialog", NULL, 0);
	pix_tree_server = load_pixmap ("tree_server", NULL, 0);
	pix_tree_util = load_pixmap ("tree_util", NULL, 0);
#endif
	/* provide inline defaults for these coz they are nice! */
	pix_tree_channel = load_pixmap ("tree_channel", png_tree_channel, 1);
	pix_tree_dialog = load_pixmap ("tree_dialog", png_tree_dialog, 1);
	pix_tree_server = load_pixmap ("tree_server", png_tree_server, 1);
	pix_tree_util = load_pixmap ("tree_util", png_tree_util, 1);

	/* non-replaceable book pixmap */
	pix_book = gdk_pixbuf_new_from_inline (-1, png_book, FALSE, 0);
	/* used in About window, tray icon and WindowManager icon. */
	pix_hexchat = load_pixmap ("hexchat", png_hexchat, 1);
}
Example #9
0
GnibblesBoard *
gnibbles_board_new (gint t_w, gint t_h) 
{
  ClutterColor stage_color = {0x00,0x00,0x00,0xff};

  GnibblesBoard *board = g_new (GnibblesBoard, 1);
  board->width = t_w;
  board->height = t_h;
  board->level = NULL;
  board->surface =NULL;
  board->clutter_widget = gtk_clutter_embed_new ();

  ClutterActor *stage;

  load_pixmap ();

  stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (board->clutter_widget));
  clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);

  clutter_stage_set_user_resizable (CLUTTER_STAGE(stage), FALSE); 
  clutter_actor_set_size (CLUTTER_ACTOR (stage), 
                        properties->tilesize * BOARDWIDTH,
                        properties->tilesize * BOARDHEIGHT);
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), FALSE);
  clutter_actor_show (stage);

  gchar *filename;
  const char *dirname;

  dirname = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
  filename = g_build_filename (dirname, "wall-small-empty.svg", NULL);

  /* Using ClutterScript to set special texture property such as "repeat-x",
   * "repeat-y" and "keep-aspect-ratio" */
  gchar texture_script[200];

  g_sprintf (texture_script, "["
                             "  {"
                             "    \"id\" : \"surface\","
                             "    \"type\" : \"ClutterTexture\","
                             "    \"filename\" : \"%s\","
                             "    \"x\" : 0,"
                             "    \"y\" : 0,"
                             "    \"width\" : %d,"
                             "    \"height\" : %d,"
                             "    \"keep-aspect-ratio\" : true"
                             "    \"visible\" : true,"
                             "    \"repeat-x\" : true,"
                             "    \"repeat-y\" : true"
                             "  }"
                             "]",
                             filename,
                             properties->tilesize,
                             properties->tilesize);

  ClutterScript *script = clutter_script_new ();

  clutter_script_load_from_data (script, texture_script, -1, NULL);
  clutter_script_get_objects (script, "surface", &(board->surface), NULL);

  clutter_actor_set_size (CLUTTER_ACTOR (board->surface),
                          properties->tilesize * BOARDWIDTH,
                          properties->tilesize * BOARDHEIGHT);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), board->surface);
  clutter_actor_show (board->surface);

  g_object_unref (script);
  return board;
}