fax_list_manager.h
来自「linux pritner GUI」· C头文件 代码 · 共 171 行
H
171 行
/* Copyright (C) 2001 to 2004 Chris VineThis program is distributed under the General Public Licence, version 2.For particulars of this and relevant disclaimers see the fileCOPYING distributed with the source files.*/#ifndef FAX_LIST_MANAGER_H#define FAX_LIST_MANAGER_H#include "prog_defs.h"#include <string>#include <list>#include <map>#include <set>#include <fstream>#include <utility>#include <gtkmm/treeview.h>#include <gtkmm/treeviewcolumn.h>#include <gtkmm/treemodelcolumn.h>#include <gtkmm/liststore.h>#include <gtkmm/treemodel.h>#include <gtkmm/treepath.h>#include <gtkmm/treestore.h>#include <gtkmm/targetentry.h>#include <gtkmm/treeiter.h>#include <gtkmm/container.h>#include <gdkmm/pixbuf.h>#include <glibmm/ustring.h>#include <glibmm/refptr.h>#include <sigc++/sigc++.h>#include "tree_model_row_reference.h"typedef std::map<std::string, TreeModelRowReference> FolderToRowMap;typedef std::multimap<std::string, std::string> FolderToFaxMap;typedef std::map<std::string, std::string> FaxToFolderMap;namespace FaxListEnum { enum Mode {received, sent};}class FaxListManager;class FolderListModelColumns: public Gtk::TreeModel::ColumnRecord { Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon; Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn<bool> root_only; // private constructor - only FaxListManager can create objects of this class FolderListModelColumns(void) {add(icon); add(name); add(root_only);}public: friend class FaxListManager;};class FaxListModelColumns: public Gtk::TreeModel::ColumnRecord { Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn<Glib::ustring> fax_description; // private constructor - only FaxListManager can create objects of this class FaxListModelColumns(void) {add(name); add(fax_description);}public: friend class FaxListManager;};class FolderNameValidator { std::set<std::string> folder_set;public: void clear(void) {folder_set.clear();} void insert_folder_name(const std::string& name) {folder_set.insert(name);} void erase_folder_name(const std::string& name) {folder_set.erase(name);} std::pair<bool, Glib::ustring> validate(const Glib::ustring&);};class FaxListManager: public sigc::trackable { FaxListEnum::Mode mode; bool folder_drag_source_enabled; bool fax_drag_source_enabled; Gtk::TreeModel::iterator drag_row_iter; bool drag_is_fax; FolderListModelColumns folder_model_columns; FaxListModelColumns fax_model_columns; Gtk::TreeView folder_tree_view; Gtk::TreeView fax_tree_view; Gtk::TreeView::Column folder_tree_view_column; Glib::RefPtr<Gtk::TreeStore> folder_tree_store_r; Glib::RefPtr<Gtk::ListStore> fax_list_store_r; std::list<Gtk::TargetEntry> target_list; Glib::RefPtr<Gdk::Pixbuf> folder_icon_r; FolderToFaxMap folder_to_fax_map; FaxToFolderMap fax_to_folder_map; FolderNameValidator folder_name_validator; std::string get_pathname_for_folder(Gtk::TreeModel::iterator); void populate_fax_list(void); bool get_folders(FolderToRowMap&, const std::string&); void move_fax(const Gtk::TreeModel::iterator&, const std::string&); void move_folder(Gtk::TreeModel::iterator, Gtk::TreeViewDropPosition, const std::string&); void move_child_folders_for_level(const Gtk::TreeModel::Children&, const Gtk::TreeModel::Children&, const std::string&, const std::string&, bool); bool is_valid_drop_path(const std::string&, const std::string&); void remap_faxes_in_folder(const std::string&, const std::string&); void display_faxes_slot(void); void write_path(void); void write_folderpath_for_level(const Gtk::TreeModel::Children&, std::ofstream&); void fax_selected_slot(void) {selection_notify();} void folder_selected_slot(void) {selection_notify();} void folder_tree_view_drag_begin_slot(const Glib::RefPtr<Gdk::DragContext>&); void fax_tree_view_drag_begin_slot(const Glib::RefPtr<Gdk::DragContext>&); bool drag_motion_slot(const Glib::RefPtr<Gdk::DragContext>&, int, int, guint); void folder_tree_view_motion_notify_slot(GdkEventMotion*); void fax_tree_view_motion_notify_slot(GdkEventMotion*);#if GTKMM_VERSION >= 24 void folder_drag_data_get_slot(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData&, guint, guint); void fax_drag_data_get_slot(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData&, guint, guint); void drag_data_received_slot(const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint); #else void folder_drag_data_get_slot(const Glib::RefPtr<Gdk::DragContext>&, GtkSelectionData*, guint, guint); void fax_drag_data_get_slot(const Glib::RefPtr<Gdk::DragContext>&, GtkSelectionData*, guint, guint); void drag_data_received_slot(const Glib::RefPtr<Gdk::DragContext>&, int, int, GtkSelectionData*, guint, guint);#endifpublic: sigc::signal0<void> selection_notify; void insert_folder_tree_view(Gtk::Container& container) { container.add(folder_tree_view); } void insert_fax_tree_view(Gtk::Container& container) { container.add(fax_tree_view); } void delete_fax(void); void delete_folder(void); std::pair<bool, Glib::ustring> is_folder_name_valid(const Glib::ustring& folder_name) { return folder_name_validator.validate(folder_name); } void make_folder(const Glib::ustring&, bool test_valid = true); void refresh(void); void describe_fax(const Glib::ustring&); bool is_fax_selected(void) {return (bool)fax_tree_view.get_selection()->get_selected();} bool is_folder_selected(void) {return (bool)folder_tree_view.get_selection()->get_selected();} bool is_folder_empty(void); Glib::ustring get_fax_number(void); Glib::ustring get_fax_description(void); Glib::ustring get_folder_name(void); FaxListManager(FaxListEnum::Mode);};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?