~ubuntu-branches/ubuntu/lucid/groundhog/lucid

« back to all changes in this revision

Viewing changes to src/icons.cc

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2004-08-20 23:12:32 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040820231232-18s0op2f9g21ag1z
Tags: 1.4-6
Update Policy Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Groundhog -- a simple logic game
 
2
 * Copyright (C) 1998-2002 Maurits Rijk
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#include <config.h>
 
20
 
 
21
#include "icons.h"
 
22
 
 
23
#include "pixmaps/champagne.xpm"
 
24
#include "pixmaps/groundhog.xpm"
 
25
#include "pixmaps/highscore.xpm"
 
26
#include "pixmaps/new.xpm"
 
27
#include "pixmaps/tube_left.xpm"
 
28
#include "pixmaps/tube_right.xpm"
 
29
 
 
30
#include "pixmaps/left_blue.xpm"
 
31
#include "pixmaps/left_green.xpm"
 
32
#include "pixmaps/left_red.xpm"
 
33
#include "pixmaps/left_yellow.xpm"
 
34
#include "pixmaps/lower_blue.xpm"
 
35
#include "pixmaps/lower_green.xpm"
 
36
#include "pixmaps/lower_red.xpm"
 
37
#include "pixmaps/lower_yellow.xpm"
 
38
#include "pixmaps/right_blue.xpm"
 
39
#include "pixmaps/right_green.xpm"
 
40
#include "pixmaps/right_red.xpm"
 
41
#include "pixmaps/right_yellow.xpm"
 
42
#include "pixmaps/upper_blue.xpm"
 
43
#include "pixmaps/upper_green.xpm"
 
44
#include "pixmaps/upper_red.xpm"
 
45
#include "pixmaps/upper_yellow.xpm"
 
46
 
 
47
GtkIconSize Icons::_size = GTK_ICON_SIZE_INVALID;
 
48
 
 
49
void
 
50
Icons::Add(const gchar *stock_id, const char **xpm_data)
 
51
{
 
52
   GdkPixbuf  *pixbuf = gdk_pixbuf_new_from_xpm_data(xpm_data);
 
53
   GtkIconSet *icon_set = gtk_icon_set_new_from_pixbuf(pixbuf);
 
54
 
 
55
   gtk_icon_factory_add(_factory, stock_id, icon_set);
 
56
   g_object_unref(G_OBJECT(pixbuf));
 
57
   gtk_icon_set_unref(icon_set);
 
58
}
 
59
 
 
60
Icons::Icons()
 
61
{
 
62
   _factory = gtk_icon_factory_new();
 
63
}
 
64
 
 
65
void
 
66
Icons::Init()
 
67
{
 
68
   Add(GROUNDHOG_STOCK_ABOUT, (const char**) groundhog_xpm);
 
69
   Add(GROUNDHOG_STOCK_CHAMPAGNE, (const char**) champagne_xpm);
 
70
   Add(GROUNDHOG_STOCK_HIGHSCORE, (const char**) highscore_xpm);
 
71
   Add(GROUNDHOG_STOCK_NEW, (const char**) new_xpm);
 
72
   Add(GROUNDHOG_STOCK_TUBE_LEFT, (const char**) tube_left_xpm);
 
73
   Add(GROUNDHOG_STOCK_TUBE_RIGHT, (const char**) tube_right_xpm);
 
74
   Add(GROUNDHOG_STOCK_LEFT_BLUE, (const char**) left_blue_xpm);
 
75
   Add(GROUNDHOG_STOCK_LEFT_GREEN, (const char**) left_green_xpm);
 
76
   Add(GROUNDHOG_STOCK_LEFT_RED, (const char**) left_red_xpm);
 
77
   Add(GROUNDHOG_STOCK_LEFT_YELLOW, (const char**) left_yellow_xpm);
 
78
   Add(GROUNDHOG_STOCK_LOWER_BLUE, (const char**) lower_blue_xpm);
 
79
   Add(GROUNDHOG_STOCK_LOWER_GREEN, (const char**) lower_green_xpm);
 
80
   Add(GROUNDHOG_STOCK_LOWER_RED, (const char**) lower_red_xpm);
 
81
   Add(GROUNDHOG_STOCK_LOWER_YELLOW, (const char**) lower_yellow_xpm);
 
82
   Add(GROUNDHOG_STOCK_RIGHT_BLUE, (const char**) right_blue_xpm);
 
83
   Add(GROUNDHOG_STOCK_RIGHT_GREEN, (const char**) right_green_xpm);
 
84
   Add(GROUNDHOG_STOCK_RIGHT_RED, (const char**) right_red_xpm);
 
85
   Add(GROUNDHOG_STOCK_RIGHT_YELLOW, (const char**) right_yellow_xpm);
 
86
   Add(GROUNDHOG_STOCK_UPPER_BLUE, (const char**) upper_blue_xpm);
 
87
   Add(GROUNDHOG_STOCK_UPPER_GREEN, (const char**) upper_green_xpm);
 
88
   Add(GROUNDHOG_STOCK_UPPER_RED, (const char**) upper_red_xpm);
 
89
   Add(GROUNDHOG_STOCK_UPPER_YELLOW, (const char**) upper_yellow_xpm);
 
90
 
 
91
   gtk_icon_factory_add_default(_factory);   
 
92
   _size = gtk_icon_size_register(GROUNDHOG_SIZE, 32, 32);
 
93
}