Source

lrc / src / gui / AddRemoveHandlers.hxx

/*
 * AddRemoveHandlers.hxx
 *
 * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */


/*! \file AddRemoveHandlers.hxx
 *
 * This file contains the AddRemoveHandlers class. This class is responsible
 * for the actions if the user clicks the "Add" or "Remove" button on the
 * main window
 *
 * \author Andreas Tscharner
 * \date 2012-08-31
 */


#ifndef __ADDREMOVEHANDLERS_HXX__
#define __ADDREMOVEHANDLERS_HXX__


#include <gtkmm/button.h>
#include <gtkmm/builder.h>
#include <gtkmm/filechooserdialog.h>
#include "ListHandler.hxx"


/*! \class AddRemoveHandlers
 *  \brief Class to handle the two main buttons
 *
 * Class that handles the clicks on the "Add" and the "Remove" button on the
 * main window
 */
class AddRemoveHandlers
{
	private:
		Glib::RefPtr<Gtk::Builder> m_refBuilder; //!< Reference to main builder
		Gtk::Button *m_addButton;      //!< Reference to "Add" button
		Gtk::Button *m_removeButton;   //!< Reference to "Remove" button
		Gtk::FileChooserDialog *m_addFilesDlg;   //!< Reference to "Add Files" dialog
		ListHandler *m_listHandler;    //!< Reference to (global) list handler class

	protected:
		/*! \brief Signal handler for "Add" button
		 *
		 * This method is the actual signal handler for the "Add" button. It
		 * shows the file selection window and adds all selected files to
		 * the list of resource files
		 */
		void on_add_button_clicked(void);
		/*! \brief Signal handler for "Remove" button
		 *
		 * This method is the actual sognal handler for the "Remove" button.
		 * It removes all selected files from the list of resource files.
		 */
		void on_remove_button_clicked(void);

	public:
		/*! \brief Constructor
		 *
		 * The constructor connects the "clicked" signals of the "Add" and
		 * "Remove" buttons with the corresponding singnal handler methods
		 *
		 * \param[in] p_refBuilder Reference to the builder that loaded the
		 *                         glade GUI file
		 */
		AddRemoveHandlers(Glib::RefPtr<Gtk::Builder>);
		/*! \brief Destructor
		 *
		 * Frees all the used memory
		 */
		~AddRemoveHandlers(void);

		/*! \brief Set instance of list handler
		 *
		 * This method is used to provide a ListHandler instance for this
		 * class. It should be used by the MainWindow constructor
		 *
		 * \retval NO_ERROR Instance successfully set
		 */
		int setListHandler(ListHandler *);
};


#endif /* __ADDREMOVEHANDLERS_HXX__ */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.