Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
gtkframewindow.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2013,2022 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 #ifndef GTKFRAMEWINDOW_HPP
44 #define GTKFRAMEWINDOW_HPP 1
45 
46 
47 #include <cairo.h>
48 #include <gtk/gtk.h>
49 #include "gtkwindow.hpp"
50 #include "gtkplotter.hpp"
51 #include "frame.hpp"
52 #include "graph3d.hpp"
53 
54 
55 
61 class GTKFrameWindow : public GTKWindow {
62 
63  size_t _width;
64  size_t _height;
65 
66  GtkWidget *_trackwindow;
67  GtkWidget *_tracklabel;
68 
69  cairo_t *_cairo;
70  cairo_surface_t *_surface;
71 
72  void hardcopy( void );
73  void move( int action, double x, double y );
74  void track( int action, double x, double y );
75  void zoom_out( double x, double y );
76  void zoom_in( double x, double y );
77  void zoom_window( int action, double x, double y );
78 
79  void darea_motion( GdkEventMotion *event );
80  void darea_enter( GdkEventCrossing *event );
81  void darea_leave( GdkEventCrossing *event );
82  void darea_button( GdkEventButton *event );
83 
84  void configure( void );
85  void delete_window( void );
86 
87  void menuitem_tool_change( GtkToolButton *button );
88  void menuitem_preferences( GtkMenuItem *menuitem );
89 
90  void frame_draw( void );
91 
92  static gboolean window_delete_signal( GtkWidget *widget,
93  GdkEventExpose *event,
94  gpointer object );
95 
96  static void menuitem_quit_signal( GtkMenuItem *menuitem,
97  gpointer object );
98  static void menuitem_tool_change_signal( GtkToolButton *button,
99  gpointer object );
100  static void menuitem_hardcopy_signal( GtkToolButton *button,
101  gpointer object );
102  static void menuitem_zoom_fit_signal( GtkToolButton *button,
103  gpointer object );
104  static void menuitem_preferences_signal( GtkMenuItem *menuitem,
105  gpointer object );
106 
107  static gboolean darea_configure_signal( GtkWidget *widget,
108  GdkEventConfigure *event,
109  gpointer object );
110  static gboolean darea_draw_signal( GtkWidget *widget,
111  cairo_t *cairo,
112  gpointer object );
113  static gboolean darea_button_signal( GtkWidget *widget,
114  GdkEventButton *event,
115  gpointer object );
116  static gboolean darea_motion_signal( GtkWidget *widget,
117  GdkEventMotion *event,
118  gpointer object );
119  static gboolean darea_enter_signal( GtkWidget *widget,
120  GdkEventCrossing *event,
121  gpointer object );
122  static gboolean darea_leave_signal( GtkWidget *widget,
123  GdkEventCrossing *event,
124  gpointer object );
125 
126 protected:
127 
128  GTKPlotter &_plotter;
129 
130  Frame _frame;
131  GtkWidget *_window;
132  GtkWidget *_darea;
133  GtkWidget *_menubar;
134  GtkWidget *_menu_file;
135  GtkWidget *_toolbar;
136  GtkWidget *_statusbar;
137 
138  GtkToolItem *_radioitem;
139 
140  double _track_px; // Track x coordinate in pixels
141  double _track_py; // Track y coordinate in pixels
142 
143  int _start[2];
144  int _end[2];
145  int _tool;
148  GTKFrameWindow( GTKPlotter &plotter );
149 
150  virtual void zoom_fit( void );
151 
157  virtual std::string track_text( double x, double y );
158 
159  void draw( cairo_t *cairo );
160  //void expose( int x, int y, int width, int height );
161 
162 public:
163 
166  virtual ~GTKFrameWindow();
167 
168  virtual void *build_preferences( GtkWidget *notebook );
169  virtual void read_preferences( GtkWidget *notebook, void *pdata );
170 
171  void draw_and_expose( void );
172  void show( void );
173 };
174 
175 
176 #endif
General purpose plotter frame for cairographics surfaces.
Definition: frame.hpp:107
Base class for interactive plotters.
Definition: gtkframewindow.hpp:61
int _end[2]
Tool specific coordinates.
Definition: gtkframewindow.hpp:144
int _draw_action
Flag for toll specific draw actions.
Definition: gtkframewindow.hpp:146
virtual std::string track_text(double x, double y)
Function which providies tracking text at (x,y)
Definition: gtkframewindow.cpp:343
virtual ~GTKFrameWindow()
Destructor.
Definition: gtkframewindow.cpp:237
int _start[2]
Tool specific coordinates.
Definition: gtkframewindow.hpp:143
int _tool
Selected tool.
Definition: gtkframewindow.hpp:145
GTK Plotter class.
Definition: gtkplotter.hpp:66
Base class for interactive plotters.
Definition: gtkwindow.hpp:49
Frame for plots
Base for three dimensional plottable graphs.
GTK based plotters.
Window for GTK plots.


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.