|
UniWidgets
1.2.0
|
00001 #ifndef _UWEBKIT_H 00002 #define _UWEBKIT_H 00003 // ------------------------------------------------------------------------- 00004 #include <gtkmm.h> 00005 #include <gdkmm.h> 00006 #include <webkit/webkit.h> 00007 #include <uwidgets/UEventBox.h> 00008 #include <global_macros.h> 00009 // ------------------------------------------------------------------------- 00016 class UWebkit : public UEventBox{ 00017 public: 00018 typedef std::string(*GetUriFunction)(const std::string path,const std::string file); 00019 inline void connect_get_uri(GetUriFunction func){get_uri = func;}; 00020 typedef void(*PostDownloadFunction)(WebKitDownloadStatus status); 00021 inline void connect_post_download(PostDownloadFunction func){post_download = func;}; 00022 private: 00023 GetUriFunction get_uri; 00024 PostDownloadFunction post_download; 00025 WebKitWebView* webview; 00026 Gtk::ScrolledWindow *scrollwin; 00027 void ctor(); 00028 static gboolean download_requested(WebKitWebView *web_view, WebKitDownload *download, UWebkit* webkit); 00029 static void download_notify_status(GObject* object, GParamSpec* pspec, UWebkit* webkit); 00030 00031 public: 00032 UWebkit(); 00033 explicit UWebkit(GtkmmBaseType::BaseObjectType* gobject); 00034 ~UWebkit(); 00035 virtual void init_widget(); 00036 00037 virtual void sensorInfo(UniSetTypes::SensorMessage *sm); 00038 virtual void askSensors(UniversalIO::UIOCommand cmd); 00040 virtual void on_realize(); 00041 00042 protected: 00044 virtual void on_url_prop_changed(); 00045 // virtual void on_enbslide_prop_changed(); 00047 virtual void on_slide_px_size_prop_changed(); 00049 virtual void on_enbscrollbar_prop_changed(); 00051 virtual void on_delay_menu_prop_changed(); 00053 virtual bool h_cross_event(GdkEvent *event); 00055 virtual bool v_cross_event(GdkEvent *event); 00057 virtual bool menu_button_press_event(GdkEvent *event); 00058 00059 bool start_soft_move; 00060 bool start_history_move; 00061 int current_x_position; 00062 double current_y_position; 00064 Gtk::Menu web_popup_menu; 00065 Gtk::ImageMenuItem* menu_go_back_item; 00066 Gtk::ImageMenuItem* menu_go_forward_item; 00067 sigc::connection long_button_press_timer; 00068 bool show_popup_menu(GdkEventButton event_btn); 00070 void check_menu_item(); 00071 void go_forward(); 00072 void go_back(); 00073 void reload(); 00074 void finde_text(); 00075 private: 00076 00077 ADD_PROPERTY( prop_url_text, Glib::ustring ) 00078 ADD_PROPERTY( prop_enbslide, bool ) 00079 ADD_PROPERTY( prop_slide_px_size, int ) 00080 ADD_PROPERTY( prop_enbscrollbar, bool ) 00081 ADD_PROPERTY( prop_delay_menu, int ) 00082 ADD_PROPERTY( prop_download_path, Glib::ustring ) 00083 }; 00084 #endif
1.7.6.1