notepad_window.h
Go to the documentation of this file.00001 #ifndef __NOTEPAD_WINDOW_H__
00002 #define __NOTEPAD_WINDOw_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <glib.h>
00033 #include <gtk/gtk.h>
00034 #include "notepad_gtk_source.h"
00035 #include "notepad_doc.h"
00036 #include "notepad_pages.h"
00037 #include <liberscribble/scb.h>
00038
00039 namespace notepad
00040 {
00041 class CNotepadWindow
00042 {
00043 private:
00044 GtkWidget* main_window;
00045 typedef gtk::GtkEventSource<CNotepadWindow> EventSource;
00046 EventSource source;
00047 CNotepadDoc notepad_doc;
00048 CNotepadPages notepad_pages;
00049 GCtx gctx;
00050 GdkImage* current_image;
00051 gboolean erscribble_mode;
00052 int erscribble_status;
00053 int erase_status;
00054 int current_page;
00055 gboolean invert_pageturn;
00056 gboolean skip_expose_events;
00057 guint doublepagefliptimout;
00058 guint pageflipto;
00059
00060 public:
00061 CNotepadWindow();
00062 ~CNotepadWindow();
00063 bool init(bool create, const gchar* filename);
00064 GtkWidget* getWindow();
00065 void show(bool show);
00066 void quit();
00067 void scribble(CNPoint& pos, int status);
00068 void erase(CNPoint& pos, int status);
00069 void pageflip_or_create();
00070 void pageflip_back();
00071 void pageflip_forward();
00072 void goto_relative_page(gint delta);
00073 void goto_page();
00074 void goto_page(gint pageno);
00075 void insert_page();
00076 void clear_current_page();
00077 void delete_current_page();
00078 void delete_current_page_impl();
00079 void update_page_counter();
00080 void update(bool full = true);
00081 void set_scribble_mode(gboolean scribble_mode);
00082 gboolean get_scribble_mode();
00083 gboolean save(bool update_last_read = false);
00084 gboolean rename();
00085 gchar* getLabel();
00086 void set_rotation(np_rotation nrotation);
00087 void set_pageturn_inverted(gboolean is_inverted);
00088 const gchar* getFilename();
00089
00090 private:
00091 CNotepadWindow(const CNotepadWindow&);
00092 CNotepadWindow& operator=(const CNotepadWindow&);
00093
00094 void draw_page_margin();
00095 void draw_image_to_window();
00096
00097
00098 static void on_jump_to_page_dialog_response(GtkDialog* dialog, gint page, gpointer data);
00099 static void on_failure_dialog_response(GtkDialog* dialog, gint response, gpointer data);
00100 static void on_sureclear_dialog_response(GtkDialog* dialog, gint response, gpointer data);
00101 static void on_suredelete_dialog_response(GtkDialog* dialog, gint response, gpointer data);
00102 static void on_rename_dialog_response(GtkDialog* dialog, gint response, gpointer data);
00103
00104 private:
00105
00106 void connect_event_handlers(GtkWidget* widget);
00107 void disconnect_event_handlers(GtkWidget* widget);
00108 void on_expose(GdkEvent *event);
00109 void on_visibility_notify(GdkEvent *event);
00110 void on_configure(GdkEvent *event);
00111 void on_button_press(GdkEvent *event);
00112 void on_button_release(GdkEvent *event);
00113 void on_motion_notify(GdkEvent *event);
00114 void on_key_press(GdkEvent *event);
00115 void on_key_release(GdkEvent *event);
00116 void on_delete(GdkEvent *event);
00117 };
00118
00119 }
00120
00121 #endif // __NOTEPAD_WINDOW_H__