3 * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
7 * gLabels 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 3 of the License, or
10 * (at your option) any later version.
12 * gLabels 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.
17 * You should have received a copy of the GNU General Public License
18 * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
23 #include "view-barcode.h"
25 #include "label-barcode.h"
27 #include "pixmaps/cursor_barcode.xbm"
28 #include "pixmaps/cursor_barcode_mask.xbm"
33 /*========================================================*/
34 /* Private macros and constants. */
35 /*========================================================*/
38 /*========================================================*/
40 /*========================================================*/
43 /*========================================================*/
44 /* Private globals. */
45 /*========================================================*/
48 /*========================================================*/
49 /* Private function prototypes. */
50 /*========================================================*/
53 /*****************************************************************************/
54 /* Return apropos cursor for create object mode. */
55 /*****************************************************************************/
57 gl_view_barcode_get_create_cursor (void)
59 GdkCursor *cursor = NULL;
60 GdkPixmap *pixmap_data, *pixmap_mask;
61 GdkColor fg = { 0, 0, 0, 0 };
62 GdkColor bg = { 0, 65535, 65535, 65535 };
64 gl_debug (DEBUG_VIEW, "START");
66 pixmap_data = gdk_bitmap_create_from_data (NULL,
67 (gchar *)cursor_barcode_bits,
69 cursor_barcode_height);
70 pixmap_mask = gdk_bitmap_create_from_data (NULL,
71 (gchar *)cursor_barcode_mask_bits,
72 cursor_barcode_mask_width,
73 cursor_barcode_mask_height);
74 cursor = gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg,
75 &bg, cursor_barcode_x_hot,
76 cursor_barcode_y_hot);
78 gl_debug (DEBUG_VIEW, "END");
84 /*****************************************************************************/
85 /* Object creation handler: button press event. */
86 /*****************************************************************************/
88 gl_view_barcode_create_button_press_event (glView *view,
93 glTextNode *text_node;
95 gl_label_unselect_all (view->label);
97 object = gl_label_barcode_new (view->label, TRUE);
99 gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
100 text_node = gl_text_node_new_from_text ("123456789");
101 gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node, FALSE);
103 view->create_object = GL_LABEL_OBJECT (object);
109 /*****************************************************************************/
110 /* Object creation handler: motion event. */
111 /*****************************************************************************/
113 gl_view_barcode_create_motion_event (glView *view,
117 gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y, FALSE);
121 /*****************************************************************************/
122 /* Object creation handler: button relesase event. */
123 /*****************************************************************************/
125 gl_view_barcode_create_button_release_event (glView *view,
129 gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y, FALSE);
135 * Local Variables: -- emacs
137 * c-basic-offset: 8 -- emacs
138 * tab-width: 8 -- emacs
139 * indent-tabs-mode: nil -- emacs