GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

treeview.hh

Go to the documentation of this file.
00001 /* GFC-UI: GTK+ Foundation Classes (User Interface Library) 00002 * Copyright (C) 2002-2004 The GFC Development Team. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * You should have received a copy of the GNU Library General Public License 00014 * along with this program; if not, write to the Free Software 00015 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00016 */ 00017 00022 00023 #ifndef GFC_GTK_TREE_VIEW_HH 00024 #define GFC_GTK_TREE_VIEW_HH 00025 00026 #ifndef GFC_GTK_CONTAINER_HH 00027 #include <gfc/gtk/container.hh> 00028 #endif 00029 00030 #ifndef GFC_GTK_CELL_RENDERER_HH 00031 #include <gfc/gtk/cellrenderer.hh> 00032 #endif 00033 00034 #ifndef GFC_GTK_TREE_SELECTION_HH 00035 #include <gfc/gtk/treeselection.hh> 00036 #endif 00037 00038 #ifndef GFC_GTK_TREE_VIEW_COLUMN_HH 00039 #include <gfc/gtk/treeviewcolumn.hh> 00040 #endif 00041 00042 #ifndef __GTK_TREE_VIEW_H__ 00043 #include <gtk/gtktreeview.h> 00044 #endif 00045 00046 namespace GFC { 00047 00048 namespace Gtk { 00049 00050 class CellRenderer; 00051 class DragContext; 00052 class TreeIter; 00053 class TreeModel; 00054 class TreePath; 00055 00058 00059 enum TreeViewDropPosition 00060 { 00061 TREE_VIEW_DROP_BEFORE = GTK_TREE_VIEW_DROP_BEFORE, 00063 00064 TREE_VIEW_DROP_AFTER = GTK_TREE_VIEW_DROP_AFTER, 00066 00067 TREE_VIEW_DROP_INTO_OR_BEFORE = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE, 00069 00070 TREE_VIEW_DROP_INTO_OR_AFTER = GTK_TREE_VIEW_DROP_INTO_OR_AFTER 00072 }; 00073 00082 00083 class TreeView : public Container 00084 { 00085 friend class G::Object; 00086 00087 TreeView(const TreeView&); 00088 TreeView& operator=(const TreeView&); 00089 00090 protected: 00093 00094 explicit TreeView(GtkTreeView *tree_view, bool owns_reference = false); 00101 00105 00106 typedef G::Signal<void, Adjustment*, Adjustment*> SetScrollAdjustmentsSignalType; 00107 typedef G::SignalProxy<TypeInstance, SetScrollAdjustmentsSignalType> SetScrollAdjustmentsSignalProxy; 00108 static const SetScrollAdjustmentsSignalType set_scroll_adjustments_signal; 00115 00116 typedef G::Signal<void, const TreePath&, TreeViewColumn&> RowActivatedSignalType; 00117 typedef G::SignalProxy<TypeInstance, RowActivatedSignalType> RowActivatedSignalProxy; 00118 static const RowActivatedSignalType row_activated_signal; 00125 00126 typedef G::Signal<bool, const TreeIter&, const TreePath&> TestExpandRowSignalType; 00127 typedef G::SignalProxy<TypeInstance, TestExpandRowSignalType> TestExpandRowSignalProxy; 00128 static const TestExpandRowSignalType test_expand_row_signal; 00136 00137 typedef G::Signal<bool, const TreeIter&, const TreePath&> TestCollapseRowSignalType; 00138 typedef G::SignalProxy<TypeInstance, TestCollapseRowSignalType> TestCollapseRowSignalProxy; 00139 static const TestCollapseRowSignalType test_collapse_row_signal; 00147 00148 typedef G::Signal<void, const TreeIter&, const TreePath&> RowExpandedSignalType; 00149 typedef G::SignalProxy<TypeInstance, RowExpandedSignalType> RowExpandedSignalProxy; 00150 static const RowExpandedSignalType row_expanded_signal; 00157 00158 typedef G::Signal<void, const TreeIter&, const TreePath&> RowCollapsedSignalType; 00159 typedef G::SignalProxy<TypeInstance, RowCollapsedSignalType> RowCollapsedSignalProxy; 00160 static const RowCollapsedSignalType row_collapsed_signal; 00167 00168 typedef G::Signal<void> ColumnsChangedSignalType; 00169 typedef G::SignalProxy<TypeInstance, ColumnsChangedSignalType> ColumnsChangedSignalProxy; 00170 static const ColumnsChangedSignalType columns_changed_signal; 00175 00176 typedef G::Signal<void> CursorChangedSignalType; 00177 typedef G::SignalProxy<TypeInstance, CursorChangedSignalType> CursorChangedSignalProxy; 00178 static const CursorChangedSignalType cursor_changed_signal; 00183 00185 00186 public: 00187 typedef CellLayout::CellDataSlot CellDataSlot; 00191 00192 typedef sigc::slot<bool, TreeView&, TreeViewColumn&, TreeViewColumn*, TreeViewColumn*> ColumnDropSlot; 00210 00211 typedef sigc::slot<void, TreeView&, const TreePath&> MappingSlot; 00220 00221 typedef sigc::slot<bool, const TreeModel&, int, const String&, const TreeIter&> SearchEqualSlot; 00233 00236 00237 TreeView(); 00239 00240 explicit TreeView(TreeModel& model); 00243 00244 virtual ~TreeView(); 00246 00250 00251 GtkTreeView* gtk_tree_view() const; 00253 00254 operator GtkTreeView* () const; 00256 00257 TreeModel* get_model() const; 00260 00261 TreeSelection* get_selection() const; 00263 00264 Adjustment* get_hadjustment() const; 00267 00268 Adjustment* get_vadjustment() const; 00271 00272 bool get_headers_visible() const; 00275 00276 TreeViewColumn* get_column(int position) const; 00280 00281 bool get_columns(std::vector<TreeViewColumn*>& columns) const; 00285 00286 TreeViewColumn* get_expander_column() const; 00290 00291 bool row_expanded(const TreePath& path) const; 00295 00296 bool get_reorderable() const; 00299 00300 void get_cursor(Pointer<TreePath> *path, TreeViewColumn **focus_column) const; 00307 00308 Gdk::Window* get_bin_window() const; 00314 00315 bool get_path_at_pos(int x, int y, Pointer<TreePath> *path, TreeViewColumn **column, int *cell_x, int *cell_y) const; 00332 00333 void get_cell_area(const TreePath *path, const TreeViewColumn *column, Gdk::Rectangle& rectangle) const; 00346 00347 Gdk::Rectangle get_cell_area(const TreePath *path, const TreeViewColumn *column) const; 00360 00361 void get_background_area(const TreePath *path, const TreeViewColumn *column, Gdk::Rectangle& rectangle) const; 00375 00376 Gdk::Rectangle get_background_area(const TreePath *path, const TreeViewColumn *column) const; 00390 00391 void get_visible_rect(Gdk::Rectangle& visible_rect) const; 00398 00399 Gdk::Rectangle get_visible_rect() const; 00405 00406 bool get_rules_hint() const; 00409 00410 void get_drag_dest_row(Pointer<TreePath> *path, TreeViewDropPosition *pos) const; 00414 00415 bool get_dest_row_at_pos(int drag_x, int drag_y, Pointer<TreePath> *path, TreeViewDropPosition *pos) const; 00425 00426 bool get_enable_search() const; 00429 00430 int get_search_column() const; 00433 00437 00438 void set_model(TreeModel *model); 00444 00445 void set_hadjustment(Adjustment *adjustment); 00448 00449 void set_vadjustment(Adjustment *adjustment); 00452 00453 void set_headers_visible(bool headers_visible); 00456 00457 void columns_autosize(); 00459 00460 void set_headers_clickable(bool setting); 00463 00464 int append_column(TreeViewColumn& column); 00468 00469 int append_column(const char *title, CellRenderer& cell, const CellColumnAttributes& attributes); 00470 int append_column(const String& title, CellRenderer& cell, const CellColumnAttributes& attributes); 00478 00479 int append_column(const char *title, CellRenderer& cell, const CellDataSlot& data); 00480 int append_column(const String& title, CellRenderer& cell, const CellDataSlot& data); 00489 00490 int insert_column(TreeViewColumn& column, int position); 00497 00498 int insert_column(int position, const char *title, CellRenderer& cell, const CellColumnAttributes& attributes); 00499 int insert_column(int position, const String& title, CellRenderer& cell, const CellColumnAttributes& attributes); 00509 00510 int insert_column(int position, const char *title, CellRenderer& cell, const CellDataSlot& data); 00511 int insert_column(int position, const String& title, CellRenderer& cell, const CellDataSlot& data); 00521 00522 int remove_column(TreeViewColumn& column); 00526 00527 void move_column_after(TreeViewColumn& column, TreeViewColumn *base_column); 00533 00534 void set_expander_column(TreeViewColumn *column); 00540 00541 void set_column_drag_function(const ColumnDropSlot& drop); 00551 00552 void scroll_to_point(int tree_x, int tree_y); 00561 00562 void scroll_to_cell(const TreePath *path, const TreeViewColumn *column); 00576 00577 void scroll_to_cell(const TreePath *path, const TreeViewColumn *column, float row_align, float col_align); 00594 00595 void row_activated(TreePath& path, TreeViewColumn& column); 00599 00600 void expand_all(); 00602 00603 void collapse_all(); 00605 00606 void expand_to_path(const TreePath& path); 00611 00612 bool expand_row(const TreePath& path, bool open_all); 00617 00618 bool collapse_row(const TreePath& path); 00622 00623 void map_expanded_rows(const MappingSlot& map); 00626 00627 void set_reorderable(bool reorderable); 00637 00638 void set_cursor(const TreePath& path, TreeViewColumn *focus_column, bool start_editing = false); 00650 00651 void set_cursor_on_cell(const TreePath& path, TreeViewColumn *focus_column, CellRenderer *focus_cell, bool start_editing = false); 00667 00668 void widget_to_tree_coords(int wx, int wy, int *tx, int *ty) const; 00675 00676 void tree_to_widget_coords(int tx, int ty, int *wx, int *wy) const; 00683 00684 void set_rules_hint(bool setting); 00696 00697 void enable_model_drag_source(Gdk::ModifierTypeField start_button_mask, 00698 const std::vector<TargetEntry>& targets, 00699 Gdk::DragActionField actions); 00708 00709 void enable_model_drag_dest(const std::vector<TargetEntry>& targets, Gdk::DragActionField actions); 00716 00717 void unset_rows_drag_source(); 00719 00720 void unset_rows_drag_dest(); 00723 00724 void set_drag_dest_row(const TreePath& path, TreeViewDropPosition pos); 00728 00729 Pointer<Gdk::Pixmap> create_row_drag_icon(const TreePath& path); 00733 00734 void set_enable_search(bool enable_search); 00737 00738 void set_search_column(int column); 00744 00745 void set_search_equal_func(const SearchEqualSlot& search_equal); 00748 00752 00753 const SetScrollAdjustmentsSignalProxy sig_set_scroll_adjustments(); 00756 00757 const RowActivatedSignalProxy sig_row_activated(); 00759 00760 const TestExpandRowSignalProxy sig_test_expand_row(); 00763 00764 const TestCollapseRowSignalProxy sig_test_collapse_row(); 00767 00768 const RowExpandedSignalProxy sig_row_expanded(); 00770 00771 const RowCollapsedSignalProxy sig_row_collapsed(); 00773 00774 const ColumnsChangedSignalProxy sig_columns_changed(); 00777 00778 const CursorChangedSignalProxy sig_cursor_changed(); 00780 00782 }; 00783 00784 } // namespace Gtk 00785 00786 } // namespace GFC 00787 00788 #include <gfc/gtk/inline/treeview.inl> 00789 00790 #endif // GFC_GTK_TREE_VIEW_HH 00791

Generated on Tue Aug 24 00:34:32 2004 for GFC-UI by doxygen 1.3.8