source: projects/visualisator/gtkpapertape.h @ 9

Last change on this file since 9 was 9, checked in by sven, 11 years ago
  • Recreated Makefiles in visualisator/ and puncher/
  • All /visualisator/ sources now compile with -Wall compiler flag
  • The basic /puncher/ sources compile with -Wall, too.
  • Added Readme for schriften/

Current development is now focussed at /puncher/frontend.gtk.c.

-- Sven @ workstation

File size: 4.6 KB
Line 
1/**
2 *
3 * The paper tape GTK widget
4 *
5 * This widget wraps the pure cairo widget "LOCHSTREIFEN" with some
6 * GTK widgets (which implement scrolling, mouse events, menues for
7 * changing parameters, etc.) and adds events and signals for simple
8 * interaction and use in applications.
9 *
10 * It can produce high quality SVG and PNG files (apart from displaying
11 * the paper tape on the screen) and is highly configurable. With
12 * only a few lines of code you can use this widget in your own
13 * programs, gtk.c shows an exemplar implementation in only about
14 * 160 lines of C code.
15 *
16 * Started 05.06.2008 13:13 (the first new project in the SVN)
17 * Copyright (C) 2008  Sven Köppel
18 *
19 * This program is free software; you can redistribute
20 * it and/or modify it under the terms of the GNU General
21 * Public License as published by the Free Software
22 * Foundation; either version 3 of the License, or (at
23 * your option) any later version.
24 *
25 * This program is distributed in the hope that it will
26 * be useful, but WITHOUT ANY WARRANTY; without even the
27 * implied warranty of MERCHANTABILITY or FITNESS FOR A
28 * PARTICULAR PURPOSE. See the GNU General Public License
29 * for more details.
30 *
31 * You should have received a copy of the GNU General
32 * Public License along with this program; if not, see
33 * <http://www.gnu.org/licenses/>.
34 *
35 **/
36
37#ifndef GTK_PAPER_TAPE_H
38#define GTK_PAPER_TAPE_H
39
40#include <glib.h>
41#include <glib-object.h>
42#include <gtk/gtk.h>
43#include "lochstreifen.h"
44
45
46G_BEGIN_DECLS
47
48/*#define GTK_PAPER_TAPE_TYPE              (gtk_paper_tape_get_type())
49#define GTK_TYPE_PAPER_TAPE              (gtk_paper_tape_get_type())
50#define GTK_PAPER_TAPE(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_PAPER_TAPE, GtkPaperTape))
51#define GTK_PAPER_TAPE_CLASS(klasse)     (G_TYPE_CHECK_CLASS_CAST((klasse), GTK_TYPE_PAPER_TAPE, GtkPaperTapeClass))
52#define GTK_IS_PAPER_TAPE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_PAPER_TAPE))
53#define GTK_IS_PAPER_TAPE_CLASS(klasse)  (G_TYPE_CHECK_CLASS_TYPE((klasse), GTK_TYPE_PAPER_TAPE))
54#define GTK_PAPER_TAPE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_PAPER_TAPE, GtkPaperTapeClass))*/
55
56#define GTK_PAPER_TAPE_TYPE            (gtk_paper_tape_get_type ())
57#define GTK_PAPER_TAPE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_PAPER_TAPE_TYPE, GtkPaperTape))
58#define GTK_PAPER_TAPE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_PAPER_TAPE_TYPE, GtkPaperTapeClass))
59#define GTK_IS_PAPER_TAPE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_PAPER_TAPE_TYPE))
60#define GTK_IS_PAPER_TAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_PAPER_TAPE_TYPE))
61
62typedef struct _GtkPaperTape GtkPaperTape;
63typedef struct _GtkPaperTapeClass GtkPaperTapeClass;
64
65struct _GtkPaperTape {
66  //GObject parent;
67  GtkWidget widget; // was GObject parent;
68  // instance members
69
70  /** Main window where this widget belongs to
71   * (to be used e.g. for modal dialogs) */
72  GtkWidget *parent_window;
73
74  /** The famous LOCHSTREIFEN widget  */
75  LOCHSTREIFEN *lochstreifen;
76
77  /** The Statusbar where the mouse movement messages appear */
78  GtkWidget *statusbar;
79
80  /**
81   * The GtkScrolledWindow where the
82   * GtkDrawingArea resides
83   */
84  GtkWidget *scroll;
85  GtkWidget *draw;
86
87  /*< private >*/
88  GtkWidget *menu_toggle_fit_screen; 
89  GTimer *last_statusbar_update;
90};
91
92struct _GtkPaperTapeClass {
93  GtkWidgetClass parent_class; //GObjectClass parent;
94};
95
96GType gtk_paper_tape_get_type(void);
97
98GtkWidget*     gtk_paper_tape_new();
99
100void gtk_paper_tape_menu_export(GtkPaperTape *papertape, GtkWidget *target_menu);
101void gtk_paper_tape_menu_view(GtkPaperTape *papertape, GtkWidget *target_menu);
102void gtk_paper_tape_menu_colors(GtkPaperTape *papertape, GtkWidget *target_menu);
103
104/* fast "almost macro" functions */
105GtkWidget *fast_color_menuitem(const GtkWidget *parentmenu, const char *dialog_title, const char *labeltext, GdkColor *initialColor, GtkSizeGroup *label_nice_sizegroup);
106GtkWidget *fast_stock_menuitem(const GtkWidget *parentmenu, const gchar *stock_id);
107GtkWidget *fast_menuitem(const GtkWidget *parentmenu, const gchar *label);
108GtkWidget *fast_menu_tearoff(const GtkWidget *parentmenu);
109GtkWidget *fast_menu_seperator(const GtkWidget *parentmenu);
110GdkColor *color_cairo2gdk(cairo_pattern_t *pattern);
111
112void gtk_paper_tape_set_data(GtkPaperTape* papertape, int length, byte_t *data);
113void gtk_paper_tape_set_null_bytes(GtkPaperTape *papertape, int beginning, int end);
114
115gboolean gtk_paper_tape_read_from_file(GtkPaperTape* papertape, char *filename);
116GtkWidget *gtk_paper_tape_get_whole_box(GtkPaperTape *papertape);
117
118G_END_DECLS
119
120#endif /* GTK_PAPER_TAPE_H */
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License