Solmyr - H3M File Manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

99 lines
3.0 KiB

  1. /* Solmyr - H3M manager
  2. * Copyright (C) 2009 Xavier Gendre
  3. *
  4. * This file is part of Solmyr.
  5. *
  6. * Solmyr is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Solmyr is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Solmyr. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef H_XG_TREEVIEW_1108090353
  20. #define H_XG_TREEVIEW_1108090353
  21. #include "filter.hpp"
  22. #include "modelcolumn.hpp"
  23. #include "pixmanager.hpp"
  24. #include <gtkmm/cellrenderer.h>
  25. #include <gtkmm/liststore.h>
  26. #include <gtkmm/textbuffer.h>
  27. #include <gtkmm/treemodel.h>
  28. #include <gtkmm/treemodelfilter.h>
  29. #include <gtkmm/treeview.h>
  30. #include <glibmm/refptr.h>
  31. namespace Solmyr
  32. {
  33. class TreeView : public Gtk::TreeView
  34. {
  35. public:
  36. TreeView();
  37. virtual ~TreeView() {}
  38. int add_row_from_file(const char *, const char *,
  39. Glib::RefPtr<Gtk::TextBuffer>);
  40. void clear_all() {m_refListStore->clear();}
  41. guint32 get_visible_number();
  42. void refresh(Solmyr::Filter);
  43. // Signal accessors
  44. typedef sigc::signal<void, Glib::ustring, Glib::ustring>
  45. sigt_row_selected;
  46. sigt_row_selected signal_row_selected()
  47. {return m_signal_row_selected;}
  48. protected:
  49. // Visibility function
  50. virtual bool visible_func(const Gtk::TreeModel::const_iterator &);
  51. // Signals
  52. sigt_row_selected m_signal_row_selected;
  53. // Signal handlers
  54. virtual void on_row_selected();
  55. // Cell renderers
  56. void allies_cr(Gtk::CellRenderer *,
  57. const Gtk::TreeModel::iterator &);
  58. void difficulty_cr(Gtk::CellRenderer *,
  59. const Gtk::TreeModel::iterator &);
  60. void loss_cr(Gtk::CellRenderer *,
  61. const Gtk::TreeModel::iterator &);
  62. void name_cr(Gtk::CellRenderer *,
  63. const Gtk::TreeModel::iterator &);
  64. void players_cr(Gtk::CellRenderer *,
  65. const Gtk::TreeModel::iterator &);
  66. void size_cr(Gtk::CellRenderer *,
  67. const Gtk::TreeModel::iterator &);
  68. void underground_cr(Gtk::CellRenderer *,
  69. const Gtk::TreeModel::iterator &);
  70. void version_cr(Gtk::CellRenderer *,
  71. const Gtk::TreeModel::iterator &);
  72. void victory_cr(Gtk::CellRenderer *,
  73. const Gtk::TreeModel::iterator &);
  74. Solmyr::ModelColumn m_column;
  75. Solmyr::Filter m_filter;
  76. Solmyr::PixManager m_pixmanager;
  77. Glib::RefPtr<Gtk::ListStore> m_refListStore;
  78. Glib::RefPtr<Gtk::TreeModelFilter> m_refTreeModelFilter;
  79. };
  80. } // namespace Solmyr
  81. #endif // H_XG_TREEVIEW_1108090353