1 /* AbiWord
2  * Copyright (C) 1998 AbiSource, Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA.
18  */
19 
20 #ifndef AP_UNIXLEFTRULER_H
21 #define AP_UNIXLEFTRULER_H
22 
23 // Class for dealing with the horizontal ruler at the left of
24 // a document window.
25 
26 /*****************************************************************/
27 
28 #include <gtk/gtk.h>
29 #include <gdk/gdk.h>
30 #include "ut_types.h"
31 #include "ap_LeftRuler.h"
32 #include "xap_UnixCustomWidget.h"
33 
34 class XAP_Frame;
35 
36 /*****************************************************************/
37 
38 class AP_UnixLeftRuler : public AP_LeftRuler, public XAP_UnixCustomWidget
39 {
40 public:
41 	AP_UnixLeftRuler(XAP_Frame * pFrame);
42 	virtual ~AP_UnixLeftRuler(void);
43 
44 	GtkWidget *		createWidget(void);
45 	virtual void	setView(AV_View * pView);
46 
47 	// cheats for the callbacks
48 	void				getWidgetPosition(gint * x, gint * y);
getWidget(void)49 	GtkWidget * 		getWidget(void) { return m_wLeftRuler; };
50 	GdkWindow * 	getRootWindow(void);
51 
52 	void _ruler_style_context_changed (void);
53 
54 protected:
55 	GtkWidget *		m_wLeftRuler;
56 	GdkWindow *	m_rootWindow;
57     guint            m_iBackgroundRedrawID;
58 protected:
59 
60 	class _fe
61 	{
62 	public:
63 		static void realize(AP_UnixLeftRuler *self);
64 		static void unrealize(AP_UnixLeftRuler *self);
65 		static gint button_press_event(GtkWidget * w, GdkEventButton * e);
66 		static gint button_release_event(GtkWidget * w, GdkEventButton * e);
67 		static gint configure_event(GtkWidget* w, GdkEventConfigure *e);
68 		static gint motion_notify_event(GtkWidget* w, GdkEventMotion* e);
69 		static gint key_press_event(GtkWidget* w, GdkEventKey* e);
70 		static gint delete_event(GtkWidget * w, GdkEvent * /*event*/, gpointer /*data*/);
71 		static void destroy (GtkWidget * /*widget*/, gpointer /*data*/);
72 	};
73 	friend class _fe;	// we consider this _fe class to be friend....
74 };
75 
76 #endif /* AP_UNIXLEFTRULER_H */
77