1541
|
1 /* BMP - Cross-platform multimedia player
|
|
2 * Copyright (C) 2003-2004 BMP development team.
|
|
3 *
|
|
4 * Based on XMMS:
|
|
5 * Copyright (C) 1998-2003 XMMS development team.
|
|
6 *
|
|
7 * This program is free software; you can redistribute it and/or modify
|
|
8 * it under the terms of the GNU General Public License as published by
|
|
9 * the Free Software Foundation; either version 2 of the License, or
|
|
10 * (at your option) any later version.
|
|
11 *
|
|
12 * This program is distributed in the hope that it will be useful,
|
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 * GNU General Public License for more details.
|
|
16 *
|
|
17 * You should have received a copy of the GNU General Public License
|
|
18 * along with this program; if not, write to the Free Software
|
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
20 */
|
|
21
|
|
22 #include "number.h"
|
|
23
|
|
24 #include <glib.h>
|
|
25 #include <gdk/gdk.h>
|
|
26
|
|
27 #include "skin.h"
|
|
28
|
|
29 void
|
|
30 number_set_number(Number * nu,
|
|
31 gint number)
|
|
32 {
|
|
33 if (number == nu->nu_number)
|
|
34 return;
|
|
35
|
|
36 nu->nu_number = number;
|
|
37 widget_draw(WIDGET(nu));
|
|
38 }
|
|
39
|
|
40 void
|
|
41 number_draw(Widget * w)
|
|
42 {
|
|
43 Number *nu = NUMBER(w);
|
|
44 GdkPixmap *obj;
|
|
45
|
|
46 obj = nu->nu_widget.parent;
|
|
47
|
|
48 if (nu->nu_number <= 11)
|
|
49 skin_draw_pixmap(bmp_active_skin, obj, nu->nu_widget.gc,
|
|
50 nu->nu_skin_index, nu->nu_number * 9, 0,
|
|
51 nu->nu_widget.x, nu->nu_widget.y, 9, 13);
|
|
52 else
|
|
53 skin_draw_pixmap(bmp_active_skin, obj, nu->nu_widget.gc,
|
|
54 nu->nu_skin_index, 90, 0, nu->nu_widget.x,
|
|
55 nu->nu_widget.y, 9, 13);
|
|
56 }
|
|
57
|
|
58 Number *
|
|
59 create_number(GList ** wlist,
|
|
60 GdkPixmap * parent,
|
|
61 GdkGC * gc,
|
|
62 gint x, gint y,
|
|
63 SkinPixmapId si)
|
|
64 {
|
|
65 Number *nu;
|
|
66
|
|
67 nu = g_new0(Number, 1);
|
|
68 widget_init(&nu->nu_widget, parent, gc, x, y, 9, 13, 1);
|
|
69 nu->nu_widget.draw = number_draw;
|
|
70 nu->nu_number = 10;
|
|
71 nu->nu_skin_index = si;
|
|
72
|
|
73 widget_list_add(wlist, WIDGET(nu));
|
|
74 return nu;
|
|
75 }
|