Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

selection.h

Go to the documentation of this file.
00001 /*  Inti: Integrated Foundation Classes
00002  *  Copyright (C) 2002-2003 The Inti 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  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018  
00028 
00029 #ifndef INTI_GTK_SELECTION_H
00030 #define INTI_GTK_SELECTION_H
00031 
00032 #ifndef INTI_G_BOXED_H
00033 #include <inti/glib/boxed.h>
00034 #endif
00035 
00036 #ifndef INTI_OBJECT_H
00037 #include <inti/object.h>
00038 #endif
00039 
00040 #ifndef INTI_UTF_STRING_H
00041 #include <inti/utf-string.h>
00042 #endif
00043 
00044 #ifndef INTI_GDK_TYPES_H
00045 #include <inti/gdk/types.h>
00046 #endif
00047 
00048 #ifndef INTI_GTK_DND_H
00049 #include <inti/gtk/dnd.h>
00050 #endif
00051 
00052 #ifndef _CPP_VECTOR
00053 #include <vector>
00054 #endif
00055 
00056 namespace Inti {
00057 
00058 namespace Gdk {
00059 class Display;
00060 }
00061 
00062 namespace Gtk {
00063         
00064 class TreeModel;
00065 class TreePath;
00066         
00079 
00080 class SelectionData : public G::Boxed
00081 {
00082         SelectionData(const SelectionData&);
00083         SelectionData& operator=(const SelectionData&);
00084 
00085 public:
00088 
00089         explicit SelectionData(GtkSelectionData *data);
00097 
00098         SelectionData(GtkSelectionData *data, bool copy);
00108         
00109         ~SelectionData();
00111 
00115 
00116         GtkSelectionData* gtk_selection_data() const { return (GtkSelectionData*)boxed_; }
00118 
00119         bool is_valid() const;
00121 
00122         Gdk::Atom selection() const;
00124 
00125         String get_selection() const;
00127 
00128         Gdk::Atom target() const;
00130 
00131         String get_target() const;
00133 
00134         Gdk::Atom type() const;
00136 
00137         String get_type() const;
00139 
00140         int format() const;
00142 
00143         unsigned char* data() const;
00145 
00146         int length() const;
00148 
00149         Gdk::Display* display() const;
00151         
00152         String get_text() const;
00156 
00157         bool get_targets(std::vector<Gdk::Atom>& targets) const;
00164 
00165         bool get_targets(std::vector<String>& targets) const;
00173 
00174         bool targets_include_text() const;
00176 
00180 
00181         void set(Gdk::Atom type, int format, const void *data, int length);
00189 
00190         bool set_text(const String& str);
00195 
00199 
00200         bool get_row_drag_data(TreeModel **model, Pointer<TreePath> *path) const;
00212 
00213         bool set_row_drag_data(TreeModel& tree_model, const TreePath& path);
00221 
00223 };
00224 
00237 
00238 class TargetEntry
00239 {
00240         GtkTargetEntry entry_;
00241 
00242 public:
00245 
00246         TargetEntry();
00248 
00249         TargetEntry(const char *target_name, unsigned int unique_id, Gtk::TargetFlagsField drag_flags = 0);
00257         
00261 
00262         GtkTargetEntry* gtk_target_entry() const { return const_cast<GtkTargetEntry*>(&entry_); }
00264 
00265         const char* target() const;
00267 
00268         unsigned int flags() const;
00272 
00273         unsigned int info() const;
00276         
00280 
00281         void set(const char *target_name, unsigned int unique_id, Gtk::TargetFlagsField drag_flags = 0);
00289         
00291 };
00292 
00306 
00307 class TargetList : public ReferencedObject
00308 {
00309         GtkTargetList *target_list_;
00310         
00311 public:
00314 
00315         TargetList(); 
00317 
00318         TargetList(const std::vector<TargetEntry>& targets);
00321 
00322         explicit TargetList(GtkTargetList *target_list);
00325 
00326         TargetList(const TargetList& src);
00329 
00330         virtual ~TargetList();
00332 
00333         TargetList& operator=(const TargetList& src);
00336 
00340 
00341         GtkTargetList* gtk_target_list() const { return (GtkTargetList*)target_list_; }
00343 
00344         operator GtkTargetList* () const;
00346         
00350 
00351         void add(Gdk::Atom target, unsigned int flags, unsigned int info);
00356 
00357         void add(const TargetEntry& entry);
00360 
00361         void add(const std::vector<TargetEntry>& targets);
00364 
00365         void remove(Gdk::Atom target);
00368 
00369         bool find(Gdk::Atom target, unsigned int *info);
00374         
00376 };
00377 
00378 } // namespace Gtk
00379 
00380 } // namespace Inti
00381 
00382 #endif // INTI_GTK_SELECTION_H
00383 
Main Page - Footer


Generated on Sun Sep 14 20:08:04 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002