KitListGui Class Reference

Encapsulates the methods for the application's GUI front end. More...

#include <kitlistgui.hpp>

List of all members.

Public Member Functions

 KitListGui (int argc, char **argv, Service &service)
 ~KitListGui ()
virtual void open_file (const Glib::ustring &filename)
 Opens an existing XML document.
virtual void raise ()
 Make this application topmost.
virtual void safe_open_file (const Glib::ustring &filename)
 Opens an existing XML document, checking for unsaved changes.
void run ()
 Starts the GUI application running.

Protected Member Functions

virtual void init ()
virtual gint get_max_recent_files ()
virtual ModelItemContainerget_selected_items ()
 Returns a list of items selected in the item list.
virtual void add_items (const ModelItemContainer &items)
 Associates the passed list of items with the currently selected category.
virtual void set_page_title (const Glib::ustring page_title)
virtual void close_preferences_window ()
virtual void cancel_preferences_window ()
virtual void close_add_item_window ()
virtual void cancel_add_item_window ()
virtual void close_add_category_window ()
 Called when the add/rename category dialog is closed using the 'OK' button.
virtual void cancel_add_category_window ()
 Called when the add/rename category dialog is closed using the 'Cancel' button.
virtual long get_selected_category ()
 Returns the ID of the currently selected Category.
virtual void init_add_item_window ()
virtual void delete_selected_items ()
 Deletes the currently selected items.
virtual ModelItemContainercopy_selected_items_to_clipboard ()
virtual bool confirm_lose_changes (const Glib::ustring &message)
 Shows a confirmation message.
virtual void update_recent_files_menu ()
 Updates the recent files sub menu.
virtual void update_recent_files (const Glib::ustring &filename)
virtual bool on_delete_event (GdkEventAny *event)
 Called when the application is closed by the user.
virtual void on_menu_quit ()
 Called when the user chooses to quit the application.
virtual void on_menu_file_new ()
 Creates a new empty model.
virtual void on_menu_file_open ()
 Allows the user to open an existing XML document.
virtual void on_menu_save ()
 Saves the current application state.
virtual void on_menu_save_as ()
 Saves the current application state in a new document.
void on_printoperation_done (Gtk::PrintOperationResult result, const Glib::RefPtr< Gtk::PrintOperation > &op)
 Called when the printer operation is done.
void on_printoperation_status_changed (const Glib::RefPtr< Gtk::PrintOperation > &op)
 Called when the print status changes.
virtual void on_menu_print ()
 Prints the kit list.
virtual void on_menu_export_to_pdf ()
virtual void on_menu_recent_file (const Glib::ustring &filename)
 displays the most recent files menu
virtual void on_menu_preferences ()
virtual void on_menu_add ()
virtual void on_menu_delete ()
 Called when the user chooses to delete items.
virtual void on_menu_cut ()
virtual void on_menu_copy ()
 Called when the use chooses the 'copy' menu option.
virtual void on_menu_paste ()
 Called when the user chooses the 'paste' menu option.
virtual void on_menu_show_all ()
 Causes all items to be displayed.
virtual void on_menu_show_checked ()
 Causes only checked items to be displayed.
virtual void on_menu_show_unchecked ()
 Causes only unchecked items to be displayed.
virtual void on_menu_select_all ()
 Called when the user chooses the 'select all' menu option.
virtual void on_menu_check_selected ()
 Marks all selected items as checked.
virtual void on_menu_uncheck_selected ()
 Marks all selected items as unchecked.
virtual void on_menu_create_category ()
 Called when the user chooses to create a new category.
virtual void on_menu_delete_category ()
 Called when the user chooses the delete category menu option.
virtual void on_menu_rename_category ()
 Called when the user chooses to rename a category.
virtual void on_menu_help_about ()
virtual void on_menu_help_contents ()
virtual void on_clipboard_get (Gtk::SelectionData &selection_date, guint)
virtual void on_clipboard_clear ()
 This method gets called after a second 'copy' operation.
virtual void on_clipboard_received (const Gtk::SelectionData &selection_data)
virtual void on_category_change ()
virtual void on_cell_edit (const Glib::ustring s)
 Callback method called when a cell has been edited in the item list.
virtual bool choose_filename (Glib::ustring &filename)
 Displays a file chooser dialog for a user to choose a filename.
virtual bool choose_pdf_filename (Glib::ustring &filename)
 Displays a file chooser dialog for a user to choose a filename for export to PDF.
virtual void update_paste_status ()
 Enables or disables the paste menu option.
virtual void paste_status_received (const Glib::StringArrayHandle &targets_array)
virtual void paste_from_xml (const Glib::ustring &document)
virtual void refresh_item_list ()
virtual void refresh_category_list (long cat_id=-2)
 Refreshes the category combo box list.
virtual void selected_row_callback (const Gtk::TreeModel::iterator &iter)
virtual void set_selected (bool checked)
virtual void toggle_selected ()
void on_row_changed (const Gtk::TreeModel::Path path, const Gtk::TreeModel::iterator iter)
 Callback method called when an item has been modified in the item list.
virtual void update_item_count (size_t n)

Protected Attributes

Glib::ustring m_filename
 The filename currently associated with the loaded model.
Glib::ustring m_page_title
 The page title to be used when printing the item list.
Glib::ustring m_clipboard_items
 Holder for items pasted to the clipboard.
bool m_ignore_list_events
 Temporarily ignore events on the item list.
Gtk::Main m_kit
 The main application.
Gtk::Window * m_window
 The main application window.
Gtk::Window * m_window_preferences
 The 'Preferences' dialog.
Gtk::Entry * m_entry_page_title
 the text entry field for the page title
Gtk::Window * m_window_add_item
 The 'Add Item' dialog.
Gtk::Window * m_window_add_category
 The 'Add Category' dialog.
Gtk::Entry * m_entry_add_item
 The text entry field of the 'Add Item' dialog.
Gtk::Entry * m_entry_add_category
 The text entry field of the 'Add Category' dialog.
Gtk::ImageMenuItem * m_file_save_menu_item
 The file save menu item.
Gtk::ToolButton * m_file_save_tool_button
 The file save toolbar button.
Gtk::MenuItem * m_recent_files_menu_item
 The recent files menu item.
Gtk::ImageMenuItem * m_paste_menu_item
 The menu paste button.
Gtk::ToolButton * m_paste_tool_button
 The toolbar paste button.
Gtk::CheckButton * m_checkbutton_add_item
 The check button field of the 'Add Item' dialog.
Gtk::ComboBox * m_category_combo
 The combo box holding a list of categories.
Glib::RefPtr< Gtk::ListStore > m_ref_category_list_store
 The model backing the category combo box.
ModelCategoryColumns m_category_cols
 The definition of the category combo box columns.
Gtk::TreeView * m_item_tree_view
 The item list view definition.
ModelItemColumns m_item_cols
 The definition of the item list's columns.
Servicem_service
 The business/service object.
Glib::RefPtr< Gtk::ListStore > m_ref_item_tree_model
 The model backing the item list.
Gtk::Statusbar * m_status_bar
 The application status bar.
Glib::RefPtr< Gtk::PageSetup > m_ref_page_setup
 Printer page setup settings.
Glib::RefPtr< Gtk::PrintSettings > m_ref_printer_settings
 Printer settings.
enum gui_state m_state
 Indicates whether a category is being created or renamed.
long m_current_cat_id
 temporary reference to a category id, usually being renamed


Detailed Description

Encapsulates the methods for the application's GUI front end.

This is the GTK+ implementation.

Definition at line 100 of file kitlistgui.hpp.


Constructor & Destructor Documentation

KitListGui::KitListGui ( int  argc,
char **  argv,
Service service 
)

Constructor to create the GUI application.

Parameters:
argc command line argument count passed to Gtk::Main
argv command line arguments passed to Gtk::Main
service a reference to the Service object, providing all business/service methods.

Definition at line 294 of file kitlistgui.cpp.

References init(), m_ref_page_setup, and m_ref_printer_settings.

KitListGui::~KitListGui (  ) 

Definition at line 325 of file kitlistgui.cpp.


Member Function Documentation

void KitListGui::init (  )  [protected, virtual]

Initialises all the GUI components prior to the GUI application being run.

Definition at line 2166 of file kitlistgui.cpp.

References cancel_add_category_window(), cancel_add_item_window(), cancel_preferences_window(), close_add_category_window(), close_add_item_window(), close_preferences_window(), anonymous_namespace{kitlistgui.cpp}::DEFAULT_FILENAME, file_exists(), anonymous_namespace{kitlistgui.cpp}::GCONF_KEY, anonymous_namespace{kitlistgui.cpp}::GCONF_KEY_CURRENT_FILENAME, anonymous_namespace{kitlistgui.cpp}::GCONF_KEY_PAGE_TITLE, get_glade_ref_ptr(), Service::get_items(), anonymous_namespace{kitlistgui.cpp}::GLADE_APP_FILE, KITLIST_SERVICE_IFACE, KITLIST_SERVICE_NAME, KITLIST_SERVICE_OBJECT, m_category_cols, m_category_combo, m_checkbutton_add_item, ModelItemColumns::m_col_checked, ModelItemColumns::m_col_num, ModelItemColumns::m_col_text, ModelCategoryColumns::m_col_text, m_entry_add_category, m_entry_add_item, m_entry_page_title, m_file_save_menu_item, m_file_save_tool_button, m_filename, m_ignore_list_events, m_item_cols, m_item_tree_view, m_page_title, m_paste_menu_item, m_paste_tool_button, m_recent_files_menu_item, m_ref_category_list_store, m_ref_item_tree_model, m_service, m_status_bar, m_window, m_window_add_category, m_window_add_item, m_window_preferences, on_category_change(), on_delete_event(), on_menu_add(), on_menu_check_selected(), on_menu_copy(), on_menu_create_category(), on_menu_cut(), on_menu_delete(), on_menu_delete_category(), on_menu_export_to_pdf(), on_menu_file_new(), on_menu_file_open(), on_menu_help_about(), on_menu_help_contents(), on_menu_paste(), on_menu_preferences(), on_menu_print(), on_menu_quit(), on_menu_rename_category(), on_menu_save(), on_menu_save_as(), on_menu_select_all(), on_menu_show_all(), on_menu_show_checked(), on_menu_show_unchecked(), on_menu_uncheck_selected(), on_row_changed(), Service::open_as_xml(), refresh_category_list(), refresh_item_list(), Service::require_filename(), Service::set_model_dirty(), toggle_selected(), update_item_count(), and update_recent_files_menu().

Referenced by KitListGui().

gint KitListGui::get_max_recent_files (  )  [protected, virtual]

ModelItemContainer * KitListGui::get_selected_items (  )  [protected, virtual]

Returns a list of items selected in the item list.

Definition at line 959 of file kitlistgui.cpp.

References Service::find_item(), ModelItemColumns::m_col_num, m_item_cols, m_item_tree_view, m_ref_item_tree_model, and m_service.

Referenced by copy_selected_items_to_clipboard(), set_selected(), and toggle_selected().

void KitListGui::add_items ( const ModelItemContainer items  )  [protected, virtual]

Associates the passed list of items with the currently selected category.

Where items already exist in the Category, then are not duplicated, just silently ignored.

Definition at line 1472 of file kitlistgui.cpp.

References Service::copy_items(), get_selected_category(), m_service, and refresh_item_list().

Referenced by paste_from_xml().

void KitListGui::set_page_title ( const Glib::ustring  page_title  )  [protected, virtual]

void KitListGui::close_preferences_window (  )  [protected, virtual]

Called when the user closes the 'Preferences' dialog using the 'OK' button.

Definition at line 2023 of file kitlistgui.cpp.

References m_entry_page_title, m_window_preferences, and set_page_title().

Referenced by init().

void KitListGui::cancel_preferences_window (  )  [protected, virtual]

Definition at line 2029 of file kitlistgui.cpp.

References m_window_preferences.

Referenced by init().

void KitListGui::close_add_item_window (  )  [protected, virtual]

Called when the user closes the 'Add Item' dialog using the 'OK' button.

Definition at line 2121 of file kitlistgui.cpp.

References Service::create_item(), get_selected_category(), m_checkbutton_add_item, m_entry_add_item, m_service, m_window_add_item, refresh_item_list(), Item::set_checked(), and Item::set_description().

Referenced by init().

void KitListGui::cancel_add_item_window (  )  [protected, virtual]

Called when the user closes the 'Add Item' dialog using the 'Cancel' button.

Definition at line 2141 of file kitlistgui.cpp.

References m_window_add_item.

Referenced by init().

void KitListGui::close_add_category_window (  )  [protected, virtual]

Called when the add/rename category dialog is closed using the 'OK' button.

The same dialog is used for both creating a new category and renaming an existing one. m_state is used to indicate which operation is relevant (create or rename) and m_current_cat_id is used to indicate the category being renamed for the rename operation.

Definition at line 1226 of file kitlistgui.cpp.

References ADD_CATEGORY, Service::create_category(), Service::find_category(), Category::get_id(), m_current_cat_id, m_entry_add_category, m_service, m_state, m_window_add_category, refresh_category_list(), refresh_item_list(), Service::set_model_dirty(), and Category::set_name().

Referenced by init().

void KitListGui::cancel_add_category_window (  )  [protected, virtual]

Called when the add/rename category dialog is closed using the 'Cancel' button.

Definition at line 1251 of file kitlistgui.cpp.

References m_window_add_category.

Referenced by init().

long KitListGui::get_selected_category (  )  [protected, virtual]

Returns the ID of the currently selected Category.

Returns -1 if no Category is currently selected, or the 'all items' option is selected.

Definition at line 2104 of file kitlistgui.cpp.

References m_category_cols, m_category_combo, and ModelCategoryColumns::m_col_num.

Referenced by add_items(), close_add_item_window(), on_menu_add(), on_menu_cut(), on_menu_delete_category(), on_menu_export_to_pdf(), on_menu_print(), on_menu_rename_category(), refresh_category_list(), and refresh_item_list().

void KitListGui::init_add_item_window (  )  [protected, virtual]

Initialises the 'Add Item' dialog prior to it being displayed.

Definition at line 2091 of file kitlistgui.cpp.

References m_entry_add_item.

Referenced by on_menu_add().

void KitListGui::delete_selected_items (  )  [protected, virtual]

Deletes the currently selected items.

The items are flagged as deleted. When save is called, they will no longer be persisted, i.e. they will be permanently deleted.

Definition at line 1005 of file kitlistgui.cpp.

References Service::delete_item(), ModelItemColumns::m_col_num, m_item_cols, m_item_tree_view, m_ref_item_tree_model, m_service, refresh_item_list(), and selected_row_callback().

Referenced by on_menu_delete().

ModelItemContainer * KitListGui::copy_selected_items_to_clipboard (  )  [protected, virtual]

bool KitListGui::confirm_lose_changes ( const Glib::ustring &  message  )  [protected, virtual]

void KitListGui::update_recent_files_menu (  )  [protected, virtual]

Updates the recent files sub menu.

Definition at line 453 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::GCONF_KEY_RECENT_FILES, m_recent_files_menu_item, and on_menu_recent_file().

Referenced by init(), and update_recent_files().

void KitListGui::update_recent_files ( const Glib::ustring &  filename  )  [protected, virtual]

Updates the list of most recently used files.

Parameters:
filename The filename to append to the list it it does not already exist.

Definition at line 490 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::GCONF_KEY_RECENT_FILES, get_max_recent_files(), and update_recent_files_menu().

Referenced by on_menu_recent_file(), on_menu_save(), on_menu_save_as(), and open_file().

bool KitListGui::on_delete_event ( GdkEventAny *  event  )  [protected, virtual]

Called when the application is closed by the user.

Definition at line 519 of file kitlistgui.cpp.

References confirm_lose_changes(), Service::is_model_dirty(), m_service, and Service::set_model_dirty().

Referenced by init().

void KitListGui::on_menu_quit (  )  [protected, virtual]

Called when the user chooses to quit the application.

Definition at line 533 of file kitlistgui.cpp.

References confirm_lose_changes(), Service::is_model_dirty(), m_service, m_window, and Service::set_model_dirty().

Referenced by init().

void KitListGui::on_menu_file_new (  )  [protected, virtual]

void KitListGui::on_menu_file_open (  )  [protected, virtual]

Allows the user to open an existing XML document.

If there are unsaved changes, the user is first prompted to discard them or cancel the operation.

Definition at line 597 of file kitlistgui.cpp.

References confirm_lose_changes(), anonymous_namespace{kitlistgui.cpp}::DEFAULT_FILENAME_EXTENSION, Service::is_model_dirty(), m_service, m_status_bar, m_window, open_file(), and anonymous_namespace{kitlistgui.cpp}::SB_SAVE.

Referenced by init().

void KitListGui::on_menu_save (  )  [protected, virtual]

void KitListGui::on_menu_save_as (  )  [protected, virtual]

void KitListGui::on_printoperation_done ( Gtk::PrintOperationResult  result,
const Glib::RefPtr< Gtk::PrintOperation > &  op 
) [protected]

Called when the printer operation is done.

Definition at line 826 of file kitlistgui.cpp.

References m_ref_printer_settings, m_window, and on_printoperation_status_changed().

Referenced by on_menu_print().

void KitListGui::on_printoperation_status_changed ( const Glib::RefPtr< Gtk::PrintOperation > &  op  )  [protected]

Called when the print status changes.

Definition at line 811 of file kitlistgui.cpp.

References m_status_bar, and anonymous_namespace{kitlistgui.cpp}::SB_PRINT.

Referenced by on_printoperation_done().

void KitListGui::on_menu_print (  )  [protected, virtual]

void KitListGui::on_menu_export_to_pdf (  )  [protected, virtual]

void KitListGui::on_menu_recent_file ( const Glib::ustring &  filename  )  [protected, virtual]

void KitListGui::on_menu_preferences (  )  [protected, virtual]

Called when the user chooses the preferences option from the menu.

Definition at line 1958 of file kitlistgui.cpp.

References m_entry_page_title, m_page_title, m_window, m_window_preferences, and set_page_title().

Referenced by init().

void KitListGui::on_menu_add (  )  [protected, virtual]

void KitListGui::on_menu_delete (  )  [protected, virtual]

Called when the user chooses to delete items.

The user is prompted to confirm deletion, prior to the items being flagged as deleted in the model. Once the model is saved, the will be permanently deleted from the persistence store.

Definition at line 1037 of file kitlistgui.cpp.

References delete_selected_items(), and m_window.

Referenced by init().

void KitListGui::on_menu_cut (  )  [protected, virtual]

void KitListGui::on_menu_copy (  )  [protected, virtual]

Called when the use chooses the 'copy' menu option.

Definition at line 1122 of file kitlistgui.cpp.

References copy_selected_items_to_clipboard().

Referenced by init().

void KitListGui::on_menu_paste (  )  [protected, virtual]

Called when the user chooses the 'paste' menu option.

Definition at line 1131 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_text, m_clipboard_items, on_clipboard_received(), paste_from_xml(), and update_paste_status().

Referenced by init().

virtual void KitListGui::on_menu_show_all (  )  [inline, protected, virtual]

Causes all items to be displayed.

Definition at line 233 of file kitlistgui.hpp.

References m_service, refresh_item_list(), and Service::show_all().

Referenced by init().

virtual void KitListGui::on_menu_show_checked (  )  [inline, protected, virtual]

Causes only checked items to be displayed.

Definition at line 235 of file kitlistgui.hpp.

References m_service, refresh_item_list(), and Service::show_checked_only().

Referenced by init().

virtual void KitListGui::on_menu_show_unchecked (  )  [inline, protected, virtual]

Causes only unchecked items to be displayed.

Definition at line 237 of file kitlistgui.hpp.

References m_service, refresh_item_list(), and Service::show_unchecked_only().

Referenced by init().

void KitListGui::on_menu_select_all (  )  [protected, virtual]

Called when the user chooses the 'select all' menu option.

Definition at line 1145 of file kitlistgui.cpp.

References m_item_tree_view.

Referenced by init().

virtual void KitListGui::on_menu_check_selected (  )  [inline, protected, virtual]

Marks all selected items as checked.

Definition at line 240 of file kitlistgui.hpp.

References set_selected().

Referenced by init().

virtual void KitListGui::on_menu_uncheck_selected (  )  [inline, protected, virtual]

Marks all selected items as unchecked.

Definition at line 242 of file kitlistgui.hpp.

References set_selected().

Referenced by init().

void KitListGui::on_menu_create_category (  )  [protected, virtual]

void KitListGui::on_menu_delete_category (  )  [protected, virtual]

Called when the user chooses the delete category menu option.

Displays a confirmation box before deleting the currently selected category.

Definition at line 1262 of file kitlistgui.cpp.

References Service::delete_category(), get_selected_category(), m_service, m_status_bar, m_window, refresh_category_list(), refresh_item_list(), and anonymous_namespace{kitlistgui.cpp}::SB_MSG.

Referenced by init().

void KitListGui::on_menu_rename_category (  )  [protected, virtual]

void KitListGui::on_menu_help_about (  )  [protected, virtual]

Shows the help about dialog

Definition at line 1393 of file kitlistgui.cpp.

Referenced by init().

void KitListGui::on_menu_help_contents (  )  [protected, virtual]

Displays the help documentation

Definition at line 1379 of file kitlistgui.cpp.

Referenced by init().

void KitListGui::on_clipboard_get ( Gtk::SelectionData &  selection_data,
guint   
) [protected, virtual]

Called when the current clipboard contents are required.

Definition at line 1430 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_custom, anonymous_namespace{kitlistgui.cpp}::item_target_text, and m_clipboard_items.

Referenced by copy_selected_items_to_clipboard().

void KitListGui::on_clipboard_clear (  )  [protected, virtual]

This method gets called after a second 'copy' operation.

i.e. if we have previously called Clipboard::set() and then called it a second time. However, I think this is intended to only clean up data objects that may have been allocated by a previous call to on_clipboard_get() where we might have created an expensive object based on a list of IDs or something. This gives us the opportunity to release the big object.

However, in the way we're using the clipboard, we're holding the expensive object (in this case an XML document). We should probably be holding the list of selected ID's and only creating the XML document when the clipboard contents are requested.

As things are, we don't want to clear the XML document... m_clipboard_items.clear();

Definition at line 1461 of file kitlistgui.cpp.

Referenced by copy_selected_items_to_clipboard().

void KitListGui::on_clipboard_received ( const Gtk::SelectionData &  selection_data  )  [protected, virtual]

Callback notification method for capturing clipboard contents.

Definition at line 1520 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_custom, anonymous_namespace{kitlistgui.cpp}::item_target_text, and m_clipboard_items.

Referenced by on_menu_paste().

void KitListGui::on_category_change (  )  [protected, virtual]

Called after the user has changed the currently selected Category.

Definition at line 2149 of file kitlistgui.cpp.

References m_ignore_list_events, and refresh_item_list().

Referenced by init().

void KitListGui::on_cell_edit ( const Glib::ustring  s  )  [protected, virtual]

Callback method called when a cell has been edited in the item list.

Flags the model as dirty.

Definition at line 1570 of file kitlistgui.cpp.

References m_ignore_list_events, m_service, and Service::set_model_dirty().

bool KitListGui::choose_filename ( Glib::ustring &  filename  )  [protected, virtual]

Displays a file chooser dialog for a user to choose a filename.

If the file already exists, the user is asked to confirm whether to overwrite.

Parameters:
filename A reference to a string to populate with the chosen filename.
Returns:
true if the user selects OK, false otherwise.

Definition at line 1587 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::DEFAULT_FILENAME_EXTENSION, file_exists(), and m_window.

Referenced by on_menu_save_as().

bool KitListGui::choose_pdf_filename ( Glib::ustring &  filename  )  [protected, virtual]

Displays a file chooser dialog for a user to choose a filename for export to PDF.

If the file already exists, the user is asked to confirm whether to overwrite.

Parameters:
filename A reference to a string to populate with the chosen filename.
Returns:
true if the user selects OK, false otherwise.

Definition at line 1691 of file kitlistgui.cpp.

References file_exists(), m_window, and anonymous_namespace{kitlistgui.cpp}::PDF_FILENAME_EXTENSION.

Referenced by on_menu_export_to_pdf().

void KitListGui::update_paste_status (  )  [protected, virtual]

Enables or disables the paste menu option.

Definition at line 1779 of file kitlistgui.cpp.

References paste_status_received().

Referenced by copy_selected_items_to_clipboard(), and on_menu_paste().

void KitListGui::paste_status_received ( const Glib::StringArrayHandle &  targets_array  )  [protected, virtual]

Callback method for enabling or disabling the paste menu option based on the clipboard contents.

See also:
KitListGui::update_paste_status()

Definition at line 1791 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_custom, anonymous_namespace{kitlistgui.cpp}::item_target_text, m_paste_menu_item, and m_paste_tool_button.

Referenced by update_paste_status().

void KitListGui::paste_from_xml ( const Glib::ustring &  document  )  [protected, virtual]

Performs a paste of items from the clipboard.

Definition at line 1484 of file kitlistgui.cpp.

References add_items(), Service::find_item(), m_service, and anonymous_namespace{kitlistgui.cpp}::XML_ELEMENT_ID.

Referenced by on_menu_paste().

void KitListGui::refresh_item_list (  )  [protected, virtual]

void KitListGui::refresh_category_list ( long  cat_id = -2  )  [protected, virtual]

Refreshes the category combo box list.

Parameters:
cat_id the id of the category to select in the combo box. If set to -2 the currently selected category is used, otherwise the specified category ID is used. If the category ID does not exist, or if -1 is specified, then no category is selected.

Definition at line 1903 of file kitlistgui.cpp.

References Service::get_categories(), Category::get_id(), Category::get_name(), get_selected_category(), GuiState::is_deleted(), m_category_cols, m_category_combo, ModelCategoryColumns::m_col_num, ModelCategoryColumns::m_col_text, m_ignore_list_events, m_ref_category_list_store, and m_service.

Referenced by close_add_category_window(), init(), on_menu_create_category(), on_menu_delete_category(), on_menu_file_new(), on_menu_recent_file(), on_menu_rename_category(), and open_file().

void KitListGui::selected_row_callback ( const Gtk::TreeModel::iterator &  iter  )  [protected, virtual]

Called to delete an Item referenced by a row iterator.

Definition at line 1834 of file kitlistgui.cpp.

References Service::delete_item(), ModelItemColumns::m_col_num, m_item_cols, and m_service.

Referenced by delete_selected_items().

void KitListGui::set_selected ( bool  checked  )  [protected, virtual]

Checks or unchecks the currently selected items.

Definition at line 1408 of file kitlistgui.cpp.

References get_selected_items(), m_service, refresh_item_list(), and Service::select_items().

Referenced by on_menu_check_selected(), and on_menu_uncheck_selected().

void KitListGui::toggle_selected (  )  [protected, virtual]

Toggles the checked state of the currently selected items.

Definition at line 1419 of file kitlistgui.cpp.

References get_selected_items(), m_service, refresh_item_list(), and Service::toggle_selected_items().

Referenced by init().

void KitListGui::on_row_changed ( const Gtk::TreeModel::Path  path,
const Gtk::TreeModel::iterator  iter 
) [protected]

Callback method called when an item has been modified in the item list.

Sets the model as dirty and copies the row details to the appropriate Item in the model. The item's state is also set to dirty.

Definition at line 1818 of file kitlistgui.cpp.

References ModelItemColumns::m_col_checked, ModelItemColumns::m_col_num, ModelItemColumns::m_col_text, m_ignore_list_events, m_item_cols, m_service, Service::set_model_dirty(), and Service::update_item().

Referenced by init().

void KitListGui::update_item_count ( size_t  n  )  [protected, virtual]

Writes the count of currently displayed items to the status bar.

Definition at line 1534 of file kitlistgui.cpp.

References m_status_bar, and anonymous_namespace{kitlistgui.cpp}::SB_ITEM_COUNT.

Referenced by init(), and refresh_item_list().

void KitListGui::open_file ( const Glib::ustring &  filename  )  [virtual]

void KitListGui::raise (  )  [virtual]

Make this application topmost.

Definition at line 2157 of file kitlistgui.cpp.

References m_window.

void KitListGui::safe_open_file ( const Glib::ustring &  filename  )  [virtual]

Opens an existing XML document, checking for unsaved changes.

If there are unsaved changes, the user is first prompted to discard them or cancel the operation.

Definition at line 686 of file kitlistgui.cpp.

References confirm_lose_changes(), Service::is_model_dirty(), m_service, m_status_bar, open_file(), and anonymous_namespace{kitlistgui.cpp}::SB_SAVE.

void KitListGui::run (  ) 

Starts the GUI application running.

Definition at line 336 of file kitlistgui.cpp.

References Service::is_model_dirty(), m_filename, m_kit, m_service, m_window, and Service::save_as_xml().


Member Data Documentation

Glib::ustring KitListGui::m_filename [protected]

The filename currently associated with the loaded model.

Should be an empty string if not related to a file.

Definition at line 111 of file kitlistgui.hpp.

Referenced by confirm_lose_changes(), init(), on_menu_file_new(), on_menu_recent_file(), on_menu_save(), on_menu_save_as(), open_file(), and run().

Glib::ustring KitListGui::m_page_title [protected]

The page title to be used when printing the item list.

Definition at line 113 of file kitlistgui.hpp.

Referenced by init(), on_menu_export_to_pdf(), on_menu_preferences(), on_menu_print(), and set_page_title().

Glib::ustring KitListGui::m_clipboard_items [protected]

Holder for items pasted to the clipboard.

Definition at line 119 of file kitlistgui.hpp.

Referenced by copy_selected_items_to_clipboard(), on_clipboard_get(), on_clipboard_received(), and on_menu_paste().

Temporarily ignore events on the item list.

Definition at line 121 of file kitlistgui.hpp.

Referenced by init(), on_category_change(), on_cell_edit(), on_row_changed(), refresh_category_list(), and refresh_item_list().

Gtk::Main KitListGui::m_kit [protected]

The main application.

Definition at line 123 of file kitlistgui.hpp.

Referenced by run().

Gtk::Window* KitListGui::m_window [protected]

Gtk::Window* KitListGui::m_window_preferences [protected]

The 'Preferences' dialog.

Definition at line 138 of file kitlistgui.hpp.

Referenced by cancel_preferences_window(), close_preferences_window(), init(), and on_menu_preferences().

Gtk::Entry* KitListGui::m_entry_page_title [protected]

the text entry field for the page title

Definition at line 140 of file kitlistgui.hpp.

Referenced by close_preferences_window(), init(), and on_menu_preferences().

Gtk::Window* KitListGui::m_window_add_item [protected]

The 'Add Item' dialog.

Definition at line 142 of file kitlistgui.hpp.

Referenced by cancel_add_item_window(), close_add_item_window(), init(), and on_menu_add().

Gtk::Window* KitListGui::m_window_add_category [protected]

The 'Add Category' dialog.

Definition at line 144 of file kitlistgui.hpp.

Referenced by cancel_add_category_window(), close_add_category_window(), init(), on_menu_create_category(), and on_menu_rename_category().

Gtk::Entry* KitListGui::m_entry_add_item [protected]

The text entry field of the 'Add Item' dialog.

Definition at line 146 of file kitlistgui.hpp.

Referenced by close_add_item_window(), init(), init_add_item_window(), and on_menu_add().

Gtk::Entry* KitListGui::m_entry_add_category [protected]

The text entry field of the 'Add Category' dialog.

Definition at line 148 of file kitlistgui.hpp.

Referenced by close_add_category_window(), init(), on_menu_create_category(), and on_menu_rename_category().

Gtk::ImageMenuItem* KitListGui::m_file_save_menu_item [protected]

The file save menu item.

Definition at line 150 of file kitlistgui.hpp.

Referenced by init().

Gtk::ToolButton* KitListGui::m_file_save_tool_button [protected]

The file save toolbar button.

Definition at line 152 of file kitlistgui.hpp.

Referenced by init().

Gtk::MenuItem* KitListGui::m_recent_files_menu_item [protected]

The recent files menu item.

Definition at line 154 of file kitlistgui.hpp.

Referenced by init(), and update_recent_files_menu().

Gtk::ImageMenuItem* KitListGui::m_paste_menu_item [protected]

The menu paste button.

Definition at line 156 of file kitlistgui.hpp.

Referenced by init(), and paste_status_received().

Gtk::ToolButton* KitListGui::m_paste_tool_button [protected]

The toolbar paste button.

Definition at line 158 of file kitlistgui.hpp.

Referenced by init(), and paste_status_received().

Gtk::CheckButton* KitListGui::m_checkbutton_add_item [protected]

The check button field of the 'Add Item' dialog.

Definition at line 160 of file kitlistgui.hpp.

Referenced by close_add_item_window(), and init().

Gtk::ComboBox* KitListGui::m_category_combo [protected]

The combo box holding a list of categories.

Definition at line 162 of file kitlistgui.hpp.

Referenced by get_selected_category(), init(), and refresh_category_list().

Glib::RefPtr<Gtk::ListStore> KitListGui::m_ref_category_list_store [protected]

The model backing the category combo box.

Definition at line 164 of file kitlistgui.hpp.

Referenced by init(), and refresh_category_list().

The definition of the category combo box columns.

Definition at line 166 of file kitlistgui.hpp.

Referenced by get_selected_category(), init(), and refresh_category_list().

Gtk::TreeView* KitListGui::m_item_tree_view [protected]

The item list view definition.

Definition at line 168 of file kitlistgui.hpp.

Referenced by delete_selected_items(), get_selected_items(), init(), and on_menu_select_all().

The definition of the item list's columns.

Definition at line 170 of file kitlistgui.hpp.

Referenced by delete_selected_items(), get_selected_items(), init(), on_row_changed(), refresh_item_list(), and selected_row_callback().

Glib::RefPtr<Gtk::ListStore> KitListGui::m_ref_item_tree_model [protected]

The model backing the item list.

Definition at line 174 of file kitlistgui.hpp.

Referenced by delete_selected_items(), get_selected_items(), init(), and refresh_item_list().

Gtk::Statusbar* KitListGui::m_status_bar [protected]

Glib::RefPtr<Gtk::PageSetup> KitListGui::m_ref_page_setup [protected]

Printer page setup settings.

Definition at line 178 of file kitlistgui.hpp.

Referenced by KitListGui(), on_menu_export_to_pdf(), and on_menu_print().

Glib::RefPtr<Gtk::PrintSettings> KitListGui::m_ref_printer_settings [protected]

Printer settings.

Definition at line 180 of file kitlistgui.hpp.

Referenced by KitListGui(), on_menu_export_to_pdf(), on_menu_print(), and on_printoperation_done().

enum gui_state KitListGui::m_state [protected]

Indicates whether a category is being created or renamed.

Only used whilst the 'Add/Rename dialog is being displayed', or when it has been closed to determine the correct action.

Definition at line 188 of file kitlistgui.hpp.

Referenced by close_add_category_window(), on_menu_create_category(), and on_menu_rename_category().

long KitListGui::m_current_cat_id [protected]

temporary reference to a category id, usually being renamed

Definition at line 189 of file kitlistgui.hpp.

Referenced by close_add_category_window(), on_menu_create_category(), and on_menu_rename_category().


The documentation for this class was generated from the following files:

Copyright 2008-2010 Frank Dean