00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TEXTBOXWIDGET_H
00023 #define TEXTBOXWIDGET_H
00024
00025 #include <cairomm/surface.h>
00026 #include <gtkmm/drawingarea.h>
00027 #include <map>
00028
00034 class TextBoxEditor: public Gtk::DrawingArea {
00035 public:
00037 enum Format { FORMAT_PLAIN=0, FORMAT_BLUE, FORMAT_DATE, FORMAT_TESTIMONY_TITLE };
00038
00040 TextBoxEditor();
00041
00046 void set_text(int line, const Glib::ustring &text);
00047
00051 void set_format(const Format &format) { m_Format=format; }
00052
00053 private:
00054
00055 virtual bool on_expose_event(GdkEventExpose *e);
00056
00057
00058 virtual bool on_motion_notify_event(GdkEventMotion *e);
00059
00060
00061 void draw_line(Cairo::RefPtr<Cairo::Context> cr, const std::string &text, int x, int y);
00062
00063
00064 Cairo::RefPtr<Cairo::ImageSurface> m_BG;
00065
00067 Format m_Format;
00068
00070 int m_TextHeight;
00071
00073 int m_MouseX;
00074
00076 int m_MouseY;
00077
00079 std::map<int, Glib::ustring> m_Text;
00080 };
00081
00082 #endif