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.
17 #include "frontends/WorkArea.h"
22 #include <X11/Xft/Xft.h>
32 typedef std::map<LColor_color, boost::shared_ptr<Gdk::Color> > Map;
33 typedef Map::iterator MapIt;
34 typedef std::map<LColor_color, boost::shared_ptr<XftColor> > Map2;
35 typedef Map2::iterator MapIt2;
36 Gdk::Color * getColor(LColor_color);
37 XftColor * getXftColor(LColor_color);
38 void cacheColor(LColor_color, Gdk::Color *);
39 void cacheXftColor(LColor_color, XftColor *);
46 extern ColorCache colorCache;
50 ColorHandler(GWorkArea & owner) : owner_(owner) {}
51 XftColor * getXftColor(LColor_color clr);
52 Gdk::Color * getGdkColor(LColor_color clr);
58 class GWorkArea : public WorkArea, public sigc::trackable {
60 GWorkArea(LyXView & owner, int width, int height);
63 virtual Painter & getPainter();
65 virtual int workWidth() const;
67 virtual int workHeight() const;
68 /// return x position of window
70 /// return y position of window
73 Glib::RefPtr<Gdk::Window> getWindow();
74 Display * getDisplay() const;
75 Glib::RefPtr<Gdk::Pixmap> getPixmap();
76 Glib::RefPtr<Gdk::GC> getGC();
77 Glib::RefPtr<Gdk::Colormap> getColormap();
78 XftDraw * getXftDraw();
79 ColorHandler & getColorHandler();
81 virtual void setScrollbarParams(int height, int pos, int line_height);
82 /// a selection exists
83 virtual void haveSelection(bool) const;
85 virtual std::string const getClipboard() const;
87 virtual void putClipboard(std::string const &) const;
88 void inputCommit(gchar * str);
90 bool onExpose(GdkEventExpose * event);
91 bool onConfigure(GdkEventConfigure * event);
93 bool onScrollWheel(GdkEventScroll * event);
94 bool onButtonPress(GdkEventButton * event);
95 bool onButtonRelease(GdkEventButton * event);
96 bool onMotionNotify(GdkEventMotion * event);
97 bool onKeyPress(GdkEventKey * event);
98 void onClipboardGet(Gtk::SelectionData & selection_data, guint info);
99 void onClipboardClear();
101 Gtk::DrawingArea workArea_;
102 Gtk::VScrollbar vscrollbar_;
103 /// The pixmap overlay on the workarea
104 Glib::RefPtr<Gdk::Pixmap> workAreaPixmap_;
105 Glib::RefPtr<Gdk::GC> workAreaGC_;
106 /// the xforms-specific painter
109 ColorHandler colorHandler_;
110 GtkIMContext * imContext_;
111 std::string inputCache_;
114 } // namespace frontend