00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef XAP_UNIXFRAMEIMPL_H
00024 #define XAP_UNIXFRAMEIMPL_H
00025
00026 #ifdef HAVE_CONFIG_H
00027 #include "config.h"
00028 #endif
00029
00030 #include <gtk/gtk.h>
00031 #include "xap_FrameImpl.h"
00032 #include "ut_vector.h"
00033 #include "xap_UnixDialogFactory.h"
00034 #include "xap_UnixApp.h"
00035
00036 class EV_UnixMenuBar;
00037 class EV_UnixMenuPopup;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 class XAP_UnixFrameImpl : public XAP_FrameImpl
00049 {
00050 public:
00051 XAP_UnixFrameImpl(XAP_Frame *pFrame);
00052 friend class XAP_Frame;
00053
00054 virtual ~XAP_UnixFrameImpl();
00055
00056 GtkWidget * getTopLevelWindow() const;
00057 void setTopLevelWindow(GtkWidget * window) { m_wTopLevelWindow = window; }
00058 GtkWidget * getVBoxWidget() const;
00059 gint getNewX(void)
00060 { return m_iNewX;}
00061 gint getNewY(void)
00062 { return m_iNewY;}
00063 void focusIMIn ();
00064 void focusIMOut ();
00065 void queueIMReset () {
00066 need_im_reset = true;
00067 }
00068 void resetIMContext ();
00069
00070 private:
00071 void _setGeometry ();
00072
00073 protected:
00074 GtkIMContext * m_imContext;
00075 GtkWidget * m_wVBox;
00076
00077 GtkWidget * m_wSunkenBox;
00078 GtkWidget * m_wStatusBar;
00079
00080 GtkWidget * m_wTopLevelWindow;
00081 EV_UnixMenuBar * m_pUnixMenu;
00082
00083 bool need_im_reset;
00084
00085 GtkIMContext * getIMContext();
00086
00087 virtual bool _close();
00088 virtual bool _raise();
00089 virtual bool _show();
00090
00091 virtual GtkWidget * _createInternalWindow (void);
00092
00093 virtual void _nullUpdate () const;
00094 virtual void _initialize();
00095
00096 virtual void _setWindowIcon() = 0;
00097
00098 virtual GtkWidget * _createDocumentWindow() = 0;
00099 virtual GtkWidget * _createStatusBarWindow() = 0;
00100
00101 void _createTopLevelWindow(void);
00102 bool _updateTitle();
00103 void _createIMContext(GdkWindow* w);
00104 UT_sint32 _setInputMode(const char * szName);
00105 virtual void _setCursor(GR_Graphics::Cursor cursor);
00106
00107 virtual XAP_DialogFactory * _getDialogFactory();
00108 virtual EV_Menu * _getMainMenu();
00109 virtual EV_Toolbar * _newToolbar(XAP_Frame *pFrame,
00110 const char *szLayout,
00111 const char *szLanguage);
00112
00113 virtual bool _runModalContextMenu(AV_View * pView, const char * szMenuName,
00114 UT_sint32 x, UT_sint32 y);
00115 void setTimeOfLastEvent(guint32 eventTime);
00116
00117 virtual void _queue_resize();
00118 virtual void _rebuildMenus(void);
00119 virtual void _rebuildToolbar(UT_uint32 ibar);
00120 GtkWidget * _getSunkenBox(void) {return m_wSunkenBox;}
00121
00122 virtual void _setFullScreen(bool changeToFullScreen);
00123
00124 void _imCommit (GtkIMContext * imc, const gchar * text);
00125
00126 virtual void dragText();
00127
00128 #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON
00129
00130 public:
00131 #endif
00132 static void _imCommit_cb(GtkIMContext *imc, const gchar* text, gpointer data);
00133 static void _imPreeditStart_cb (GtkIMContext *context, gpointer data);
00134 static void _imPreeditChanged_cb (GtkIMContext *context, gpointer data);
00135 static void _imPreeditEnd_cb (GtkIMContext *context, gpointer data);
00136 static gint _imRetrieveSurrounding_cb (GtkIMContext *context, gpointer data);
00137 static gint _imDeleteSurrounding_cb (GtkIMContext *slave, gint offset, gint n_chars, gpointer data);
00138
00139
00140 class _fe
00141 {
00142 friend class XAP_Frame;
00143 public:
00144 static gint button_press_event(GtkWidget * w, GdkEventButton * e);
00145 static gint button_release_event(GtkWidget * w, GdkEventButton * e);
00146 static gint configure_event(GtkWidget* w, GdkEventConfigure *e);
00147 static gint motion_notify_event(GtkWidget* w, GdkEventMotion* e);
00148 static gint scroll_notify_event(GtkWidget* w, GdkEventScroll* e);
00149 static gint key_press_event(GtkWidget* w, GdkEventKey* e);
00150 static gint key_release_event(GtkWidget* w, GdkEventKey* e);
00151 static gint delete_event(GtkWidget * w, GdkEvent * , gpointer );
00152 #if GTK_CHECK_VERSION(3,0,0)
00153 static gint draw(GtkWidget * w, cairo_t * cr);
00154 #else
00155 static gint expose(GtkWidget * w, GdkEventExpose* pExposeEvent);
00156 #endif
00157 static gint do_ZoomUpdate( gpointer p);
00158 static void vScrollChanged(GtkAdjustment * w, gpointer );
00159 static void hScrollChanged(GtkAdjustment * w, gpointer );
00160 static void destroy (GtkWidget * , gpointer );
00161 static gboolean focus_in_event(GtkWidget *w,GdkEvent *event,gpointer user_data);
00162 static gboolean focus_out_event(GtkWidget *w,GdkEvent *event,gpointer user_data);
00163
00164 static void realize(GtkWidget * widget, GdkEvent *,gpointer );
00165 static void unrealize(GtkWidget * widget, GdkEvent *,gpointer );
00166 static void sizeAllocate(GtkWidget * widget, GdkEvent *,gpointer );
00167 static gint focusIn(GtkWidget * widget, GdkEvent *,gpointer );
00168 static gint focusOut(GtkWidget * , GdkEvent *,gpointer );
00169 };
00170 friend class _fe;
00171
00172 private:
00173 bool m_bDoZoomUpdate;
00174 UT_sint32 m_iNewX;
00175 UT_sint32 m_iNewY;
00176 UT_sint32 m_iNewWidth;
00177 UT_sint32 m_iNewHeight;
00178 guint m_iZoomUpdateID;
00179 guint m_iAbiRepaintID;
00180
00181
00182 EV_UnixMenuPopup * m_pUnixPopup;
00183 AP_UnixDialogFactory m_dialogFactory;
00184
00185 UT_uint32 m_iPreeditLen;
00186 UT_uint32 m_iPreeditStart;
00187 };
00188 #endif
00189
00190
00191