1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/*
* gMathView, mathematic expressions viewing & editing widget
*
* # Widget header
*
* Author : Guillaume Seguin
* Email : guillaume@segu.in
*
* Copyright (c) 2007 Guillaume Seguin <guillaume@segu.in>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GMATHVIEW_H
#define _GMATHVIEW_H
#include <gtk/gtk.h>
#include <cairo.h>
#include <gmathlib.h>
#include <gmathcairo.h>
#define OUTLINE_WIDTH 1
#define BASE_OFFSET 2
G_BEGIN_DECLS
#define G_TYPE_MATH_VIEW (g_math_view_get_type ())
#define G_MATH_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
G_TYPE_MATH_VIEW, GMathView))
#define G_MATH_VIEW_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), \
G_MATH_VIEW, GMathViewClass))
#define IS_G_MATH_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
G_TYPE_MATH_VIEW))
#define IS_G_MATH_VIEW_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), \
G_TYPE_MATH_VIEW))
#define G_MATH_VIEW_GET_CLASS (G_TYPE_INSTANCE_GET_CLASS ((obj), \
G_TYPE_MATH_VIEW, GMathViewClass))
typedef struct _GMathView GMathView;
typedef struct _GMathViewClass GMathViewClass;
typedef struct _GMathViewPrivate GMathViewPrivate;
struct _GMathView
{
GtkDrawingArea parent;
};
struct _GMathViewClass
{
GtkDrawingAreaClass parent_class;
};
typedef enum
{
GMathSelectionNone,
GMathSelectionOutline,
GMathSelectionHighlight
} GMathSelectionType;
GType
g_math_view_get_type (void) G_GNUC_CONST;
GtkWidget*
g_math_view_new (void);
void
g_math_view_update (GMathView *mathview);
GMathContext*
g_math_view_get_context (GMathView *mathview);
GMathFormula*
g_math_view_get_formula (GMathView *mathview);
void
g_math_view_set_formula (GMathView *mathview, GMathFormula *formula);
gboolean
g_math_view_get_editor_mode (GMathView *mathview);
void
g_math_view_set_editor_mode (GMathView *mathview, gboolean editor_mode);
G_END_DECLS
/* Helper functions */
cairo_surface_t*
g_math_view_copy_surface (cairo_surface_t *source);
void
g_math_view_outline_boxed (cairo_t *cr, GMathBoxed *boxed);
void
g_math_view_highlight_boxed (cairo_t *cr, GMathBoxed *boxed);
#endif
|