4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
19 #include "frontends/WorkArea.h"
21 #include <X11/Xft/Xft.h>
31 typedef std::map<LColor_color, Gdk::Color *> Map;
32 typedef Map::iterator MapIt;
33 typedef std::map<LColor_color, XftColor *> Map2;
34 typedef Map2::iterator MapIt2;
37 Gdk::Color * getColor(LColor_color);
38 XftColor * getXftColor(LColor_color);
39 void cacheColor(LColor_color, Gdk::Color *);
40 void cacheXftColor(LColor_color, XftColor *);
47 extern ColorCache colorCache;
52 ColorHandler(GWorkArea& owner) : owner_(owner) {}
53 XftColor * getXftColor(LColor_color clr);
54 Gdk::Color * getGdkColor(LColor_color clr);
60 class GWorkArea : public WorkArea, public SigC::Object
63 GWorkArea(LyXView & owner, int width, int height);
66 virtual Painter & getPainter();
68 virtual int workWidth() const;
70 virtual int workHeight() const;
71 /// return x position of window
73 /// return y position of window
76 Glib::RefPtr<Gdk::Window> getWindow();
77 Display * getDisplay() const;
78 Glib::RefPtr<Gdk::Pixmap> getPixmap();
79 Glib::RefPtr<Gdk::GC> getGC();
80 Glib::RefPtr<Gdk::Colormap> getColormap();
81 XftDraw * getXftDraw();
82 ColorHandler & getColorHandler();
84 virtual void setScrollbarParams(int height, int pos, int line_height);
85 /// a selection exists
86 virtual void haveSelection(bool) const;
88 virtual std::string const getClipboard() const;
90 virtual void putClipboard(std::string const &) const;
91 void inputCommit(gchar * str);
93 bool onExpose(GdkEventExpose * event);
94 bool onConfigure(GdkEventConfigure * event);
96 bool onScrollWheel(GdkEventScroll * event);
97 bool onButtonPress(GdkEventButton * event);
98 bool onButtonRelease(GdkEventButton * event);
99 bool onMotionNotify(GdkEventMotion * event);
100 bool onKeyPress(GdkEventKey * event);
101 void onClipboardGet(Gtk::SelectionData& selection_data, guint info);
102 void onClipboardClear();
104 Gtk::DrawingArea workArea_;
105 Gtk::VScrollbar vscrollbar_;
106 /// The pixmap overlay on the workarea
107 Glib::RefPtr<Gdk::Pixmap> workAreaPixmap_;
108 Glib::RefPtr<Gdk::GC> workAreaGC_;
109 /// the xforms-specific painter
112 ColorHandler colorHandler_;
113 GtkIMContext * imContext_;
114 std::string inputCache_;
117 } // namespace frontend