Debian Codegraph @

src/af/xap/gtk/xap_UnixFrameImpl.h

raw
1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
2 /* AbiSource Application Framework
3 * Copyright (C) 1998 AbiSource, Inc.
4 * Copyright (C) 2002 William Lachance
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA.
20 */
21
22
23 #ifndef XAP_UNIXFRAMEIMPL_H
24 #define XAP_UNIXFRAMEIMPL_H
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include <gtk/gtk.h>
31 #include "xap_FrameImpl.h"
32 #include "ut_vector.h"
33 #include "xap_UnixDialogFactory.h"
34 #include "xap_UnixApp.h"
35
36 class EV_UnixMenuBar;
37 class EV_UnixMenuPopup;
38
39 /********************************************************************
40 *********************************************************************
41 ** This file defines the unix-platform-specific class for the
42 ** cross-platform application frame helper. This is used to hold all
43 ** unix-specific data. One of these is created for each top-level
44 ** document window.
45 *********************************************************************
46 ********************************************************************/
47
48 class XAP_UnixFrameImpl : public XAP_FrameImpl
49 {
50 public:
51 XAP_UnixFrameImpl(XAP_Frame *pFrame);
52 friend class XAP_Frame;
53
54 virtual ~XAP_UnixFrameImpl();
55
56 GtkWidget * getTopLevelWindow() const;
57 void setTopLevelWindow(GtkWidget * window) { m_wTopLevelWindow = window; }
58 GtkWidget * getVBoxWidget() const;
59 gint getNewX(void)
60 { return m_iNewX;}
61 gint getNewY(void)
62 { return m_iNewY;}
63 void focusIMIn ();
64 void focusIMOut ();
65 void queueIMReset () {
66 need_im_reset = true;
67 }
68 void resetIMContext ();
69
70 virtual GtkWidget * getViewWidget (void) const = 0;
71
72 private:
73 void _setGeometry ();
74
75 protected:
76 GtkIMContext * m_imContext;
77 GtkWidget * m_wVBox;
78
79 GtkWidget * m_wSunkenBox;
80 GtkWidget * m_wStatusBar;
81
82 GtkWidget * m_wTopLevelWindow;
83 EV_UnixMenuBar * m_pUnixMenu;
84
85 bool need_im_reset;
86
87 GtkIMContext * getIMContext();
88
89 virtual bool _close();
90 virtual bool _raise();
91 virtual bool _show();
92
93 virtual GtkWidget * _createInternalWindow (void);
94
95 virtual void _nullUpdate () const; // a virtual member function in xap_Frame
96 virtual void _initialize();
97
98 virtual void _setWindowIcon() = 0; // should eventually be handled be the inherited helper
99
100 virtual GtkWidget * _createDocumentWindow() = 0;
101 virtual GtkWidget * _createStatusBarWindow() = 0;
102
103 void _createTopLevelWindow(void);
104 bool _updateTitle();
105 void _createIMContext(GdkWindow* w);
106 UT_sint32 _setInputMode(const char * szName);
107 virtual void _setCursor(GR_Graphics::Cursor cursor);
108
109 virtual XAP_DialogFactory * _getDialogFactory();
110 virtual EV_Menu * _getMainMenu();
111 virtual EV_Toolbar * _newToolbar(XAP_Frame *pFrame,
112 const char *szLayout,
113 const char *szLanguage);
114
115 virtual bool _runModalContextMenu(AV_View * pView, const char * szMenuName,
116 UT_sint32 x, UT_sint32 y);
117 void setTimeOfLastEvent(guint32 eventTime);
118
119 virtual void _queue_resize();
120 virtual void _rebuildMenus(void);
121 virtual void _rebuildToolbar(UT_uint32 ibar);
122 GtkWidget * _getSunkenBox(void) {return m_wSunkenBox;}
123
124 virtual void _setFullScreen(bool changeToFullScreen);
125
126 void _imCommit (GtkIMContext * imc, const gchar * text);
127
128 virtual void dragText();
129
130 #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON
131 // need to be able to get at this from XAP_UnixHildonApp
132 public:
133 #endif
134 static void _imCommit_cb(GtkIMContext *imc, const gchar* text, gpointer data);
135 static void _imPreeditStart_cb (GtkIMContext *context, gpointer data);
136 static void _imPreeditChanged_cb (GtkIMContext *context, gpointer data);
137 static void _imPreeditEnd_cb (GtkIMContext *context, gpointer data);
138 static gboolean _imRetrieveSurrounding_cb (GtkIMContext *context, gpointer data);
139 static gint _imDeleteSurrounding_cb (GtkIMContext *slave, gint offset, gint n_chars, gpointer data);
140
141
142 class _fe
143 {
144 friend class XAP_Frame;
145 public:
146 static gint button_press_event(GtkWidget * w, GdkEventButton * e);
147 static gint button_release_event(GtkWidget * w, GdkEventButton * e);
148 static gint configure_event(GtkWidget* w, GdkEventConfigure *e);
149 static gint motion_notify_event(GtkWidget* w, GdkEventMotion* e);
150 static gint scroll_notify_event(GtkWidget* w, GdkEventScroll* e);
151 static gint key_press_event(GtkWidget* w, GdkEventKey* e);
152 static gint key_release_event(GtkWidget* w, GdkEventKey* e);
153 static gint delete_event(GtkWidget * w, GdkEvent * /*event*/, gpointer /*data*/);
154 #if GTK_CHECK_VERSION(3,0,0)
155 static gboolean draw(GtkWidget * w, cairo_t * cr);
156 #else
157 static gboolean expose(GtkWidget * w, GdkEventExpose* pExposeEvent);
158 #endif
159 static gint do_ZoomUpdate( gpointer /* xap_UnixFrame * */ p);
160 static void vScrollChanged(GtkAdjustment * w, gpointer /*data*/);
161 static void hScrollChanged(GtkAdjustment * w, gpointer /*data*/);
162 static void destroy (GtkWidget * /*widget*/, gpointer /*data*/);
163 static gboolean focus_in_event(GtkWidget *w,GdkEvent *event,gpointer user_data);
164 static gboolean focus_out_event(GtkWidget *w,GdkEvent *event,gpointer user_data);
165
166 static void realize(GtkWidget * widget, GdkEvent */* e*/,gpointer /*data*/);
167 static void unrealize(GtkWidget * widget, GdkEvent */* e */,gpointer /* data */);
168 static void sizeAllocate(GtkWidget * widget, GdkEvent */* e */,gpointer /* data */);
169 static gint focusIn(GtkWidget * widget, GdkEvent */* e */,gpointer /* data */);
170 static gint focusOut(GtkWidget * /*widget*/, GdkEvent */* e */,gpointer /* data */);
171 };
172 friend class _fe;
173
174 private:
175 bool m_bDoZoomUpdate;
176 UT_sint32 m_iNewX;
177 UT_sint32 m_iNewY;
178 UT_sint32 m_iNewWidth;
179 UT_sint32 m_iNewHeight;
180 guint m_iZoomUpdateID;
181 guint m_iAbiRepaintID;
182
183
184 EV_UnixMenuPopup * m_pUnixPopup; /* only valid while a context popup is up */
185 AP_UnixDialogFactory m_dialogFactory;
186
187 UT_uint32 m_iPreeditLen;
188 UT_uint32 m_iPreeditStart;
189 };
190 #endif /* XAP_UNIXFRAME_H */
191
192
193