remaining h* interface header revision
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9,12 +9,38 @@
|
|||||||
/**
|
/**
|
||||||
@class wxHashTable
|
@class wxHashTable
|
||||||
|
|
||||||
@b Please note that this class is retained for backward compatibility
|
@deprecated
|
||||||
|
Please note that this class is retained for backward compatibility
|
||||||
reasons; you should use wxHashMap.
|
reasons; you should use wxHashMap.
|
||||||
|
|
||||||
This class provides hash table functionality for wxWidgets, and for an
|
This class provides hash table functionality for wxWidgets, and for an
|
||||||
application if it wishes. Data can be hashed on an integer or string
|
application if it wishes. Data can be hashed on an integer or string key.
|
||||||
key.
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
wxHashTable table(wxKEY_STRING);
|
||||||
|
|
||||||
|
wxPoint *point = new wxPoint(100, 200);
|
||||||
|
table.Put("point 1", point);
|
||||||
|
|
||||||
|
....
|
||||||
|
|
||||||
|
wxPoint *found_point = (wxPoint *)table.Get("point 1");
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
A hash table is implemented as an array of pointers to lists.
|
||||||
|
When no data has been stored, the hash table takes only a little more space
|
||||||
|
than this array (default size is 1000). When a data item is added, an integer
|
||||||
|
is constructed from the integer or string key that is within the bounds of the array.
|
||||||
|
If the array element is @NULL, a new (keyed) list is created for the element.
|
||||||
|
Then the data object is appended to the list, storing the key in case other
|
||||||
|
data objects need to be stored in the list also (when a 'collision' occurs).
|
||||||
|
|
||||||
|
Retrieval involves recalculating the array index from the key, and searching
|
||||||
|
along the keyed list for the data object whose stored key matches the passed key.
|
||||||
|
Obviously this is quicker when there are fewer collisions, so hashing will
|
||||||
|
become inefficient if the number of items to be stored greatly exceeds the
|
||||||
|
size of the hash table.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{containers}
|
@category{containers}
|
||||||
@@ -36,9 +62,9 @@ public:
|
|||||||
virtual ~wxHashTable();
|
virtual ~wxHashTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The counterpart of @e Next. If the application wishes to iterate
|
The counterpart of Next(). If the application wishes to iterate
|
||||||
through all the data in the hash table, it can call @e BeginFind and
|
through all the data in the hash table, it can call BeginFind() and
|
||||||
then loop on @e Next.
|
then loop on Next().
|
||||||
*/
|
*/
|
||||||
void BeginFind();
|
void BeginFind();
|
||||||
|
|
||||||
@@ -56,16 +82,15 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If set to @true data stored in hash table will be deleted when hash table object
|
If set to @true data stored in hash table will be deleted when hash table
|
||||||
is destroyed.
|
object is destroyed.
|
||||||
*/
|
*/
|
||||||
void DeleteContents(bool flag);
|
void DeleteContents(bool flag);
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Gets data from the hash table, using an integer or string key (depending on
|
Gets data from the hash table, using an integer or string key
|
||||||
which
|
(depending on which has table constructor was used).
|
||||||
has table constructor was used).
|
|
||||||
*/
|
*/
|
||||||
wxObject* Get(long key);
|
wxObject* Get(long key);
|
||||||
wxObject* Get(const char* key);
|
wxObject* Get(const char* key);
|
||||||
@@ -84,20 +109,20 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
If the application wishes to iterate through all the data in the hash
|
If the application wishes to iterate through all the data in the hash
|
||||||
table, it can call @e BeginFind and then loop on @e Next. This function
|
table, it can call BeginFind() and then loop on Next(). This function
|
||||||
returns a @b Node() pointer (or @NULL if there are no more nodes).
|
returns a @b wxHashTable::Node pointer (or @NULL if there are no more nodes).
|
||||||
|
|
||||||
The return value is functionally equivalent to @b wxNode but might not be
|
The return value is functionally equivalent to @b wxNode but might not be
|
||||||
implemented as a @b wxNode. The user will probably only wish to use the
|
implemented as a @b wxNode. The user will probably only wish to use the
|
||||||
@b GetData method to retrieve the data; the node may also be deleted.
|
wxNode::GetData() method to retrieve the data; the node may also be deleted.
|
||||||
*/
|
*/
|
||||||
wxHashTable::Node* Next();
|
wxHashTable::Node* Next();
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Inserts data into the hash table, using an integer or string key (depending on
|
Inserts data into the hash table, using an integer or string key (depending on
|
||||||
which
|
which has table constructor was used).
|
||||||
has table constructor was used). The key string is copied and stored by the hash
|
The key string is copied and stored by the hash table implementation.
|
||||||
table implementation.
|
|
||||||
*/
|
*/
|
||||||
void Put(long key, wxObject* object);
|
void Put(long key, wxObject* object);
|
||||||
void Put(const char* key, wxObject* object);
|
void Put(const char* key, wxObject* object);
|
||||||
|
@@ -10,31 +10,171 @@
|
|||||||
@class wxHashMap
|
@class wxHashMap
|
||||||
|
|
||||||
This is a simple, type-safe, and reasonably efficient hash map class,
|
This is a simple, type-safe, and reasonably efficient hash map class,
|
||||||
whose interface is a subset of the interface of STL containers. In
|
whose interface is a subset of the interface of STL containers.
|
||||||
particular, the interface is modeled after std::map, and the various,
|
In particular, the interface is modeled after std::map, and the various,
|
||||||
non-standard, std::hash_map.
|
non-standard, std::hash_map.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
class MyClass { ... };
|
||||||
|
|
||||||
|
// declare a hash map with string keys and int values
|
||||||
|
WX_DECLARE_STRING_HASH_MAP( int, MyHash5 );
|
||||||
|
// same, with int keys and MyClass* values
|
||||||
|
WX_DECLARE_HASH_MAP( int, MyClass*, wxIntegerHash, wxIntegerEqual, MyHash1 );
|
||||||
|
// same, with wxString keys and int values
|
||||||
|
WX_DECLARE_STRING_HASH_MAP( int, MyHash3 );
|
||||||
|
// same, with wxString keys and values
|
||||||
|
WX_DECLARE_STRING_HASH_MAP( wxString, MyHash2 );
|
||||||
|
|
||||||
|
MyHash1 h1;
|
||||||
|
MyHash2 h2;
|
||||||
|
|
||||||
|
// store and retrieve values
|
||||||
|
h1[1] = new MyClass( 1 );
|
||||||
|
h1[10000000] = NULL;
|
||||||
|
h1[50000] = new MyClass( 2 );
|
||||||
|
h2["Bill"] = "ABC";
|
||||||
|
wxString tmp = h2["Bill"];
|
||||||
|
// since element with key "Joe" is not present, this will return
|
||||||
|
// the default value, which is an empty string in the case of wxString
|
||||||
|
MyClass tmp2 = h2["Joe"];
|
||||||
|
|
||||||
|
// iterate over all the elements in the class
|
||||||
|
MyHash2::iterator it;
|
||||||
|
for( it = h2.begin(); it != h2.end(); ++it )
|
||||||
|
{
|
||||||
|
wxString key = it->first, value = it->second;
|
||||||
|
// do something useful with key and value
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@section hashmap_declaringnew Declaring new hash table types
|
||||||
|
|
||||||
|
@code
|
||||||
|
WX_DECLARE_STRING_HASH_MAP( VALUE_T, // type of the values
|
||||||
|
CLASSNAME ); // name of the class
|
||||||
|
@endcode
|
||||||
|
Declares a hash map class named CLASSNAME, with wxString keys and VALUE_T values.
|
||||||
|
|
||||||
|
@code
|
||||||
|
WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, // type of the values
|
||||||
|
CLASSNAME ); // name of the class
|
||||||
|
@endcode
|
||||||
|
Declares a hash map class named CLASSNAME, with void* keys and VALUE_T values.
|
||||||
|
|
||||||
|
@code
|
||||||
|
WX_DECLARE_HASH_MAP( KEY_T, // type of the keys
|
||||||
|
VALUE_T, // type of the values
|
||||||
|
HASH_T, // hasher
|
||||||
|
KEY_EQ_T, // key equality predicate
|
||||||
|
CLASSNAME); // name of the class
|
||||||
|
@endcode
|
||||||
|
The HASH_T and KEY_EQ_T are the types used for the hashing function and
|
||||||
|
key comparison. wxWidgets provides three predefined hashing functions:
|
||||||
|
wxIntegerHash for integer types ( int, long, short, and their unsigned counterparts ),
|
||||||
|
wxStringHash for strings ( wxString, wxChar*, char* ), and wxPointerHash for
|
||||||
|
any kind of pointer.
|
||||||
|
Similarly three equality predicates: wxIntegerEqual, wxStringEqual,
|
||||||
|
wxPointerEqual are provided.
|
||||||
|
Using this you could declare a hash map mapping int values to wxString like this:
|
||||||
|
|
||||||
|
@code
|
||||||
|
WX_DECLARE_HASH_MAP( int,
|
||||||
|
wxString,
|
||||||
|
wxIntegerHash,
|
||||||
|
wxIntegerEqual,
|
||||||
|
MyHash );
|
||||||
|
|
||||||
|
// using an user-defined class for keys
|
||||||
|
class MyKey { ... };
|
||||||
|
|
||||||
|
// hashing function
|
||||||
|
class MyKeyHash
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyKeyHash() { }
|
||||||
|
|
||||||
|
unsigned long operator()( const MyKey& k ) const
|
||||||
|
{
|
||||||
|
// compute the hash
|
||||||
|
}
|
||||||
|
|
||||||
|
MyKeyHash& operator=(const MyKeyHash&) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// comparison operator
|
||||||
|
class MyKeyEqual
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyKeyEqual() { }
|
||||||
|
bool operator()( const MyKey& a, const MyKey& b ) const
|
||||||
|
{
|
||||||
|
// compare for equality
|
||||||
|
}
|
||||||
|
|
||||||
|
MyKeyEqual& operator=(const MyKeyEqual&) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
|
WX_DECLARE_HASH_MAP( MyKey, // type of the keys
|
||||||
|
SOME_TYPE, // any type you like
|
||||||
|
MyKeyHash, // hasher
|
||||||
|
MyKeyEqual, // key equality predicate
|
||||||
|
CLASSNAME); // name of the class
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@section hashmap_types Types
|
||||||
|
|
||||||
|
In the documentation below you should replace wxHashMap with the name you used
|
||||||
|
in the class declaration.
|
||||||
|
|
||||||
|
- wxHashMap::key_type: Type of the hash keys.
|
||||||
|
- wxHashMap::mapped_type: Type of the values stored in the hash map.
|
||||||
|
- wxHashMap::value_type: Equivalent to struct { key_type first; mapped_type second }.
|
||||||
|
- wxHashMap::iterator: Used to enumerate all the elements in a hash map;
|
||||||
|
it is similar to a value_type*.
|
||||||
|
- wxHashMap::const_iterator: Used to enumerate all the elements in a constant
|
||||||
|
hash map; it is similar to a const value_type*.
|
||||||
|
- wxHashMap::size_type: Used for sizes.
|
||||||
|
- wxHashMap::Insert_Result: The return value for insert().
|
||||||
|
|
||||||
|
|
||||||
|
@section hashmap_iter Iterators
|
||||||
|
|
||||||
|
An iterator is similar to a pointer, and so you can use the usual pointer operations:
|
||||||
|
++it ( and it++ ) to move to the next element, *it to access the element pointed to,
|
||||||
|
it->first ( it->second ) to access the key ( value ) of the element pointed to.
|
||||||
|
|
||||||
|
Hash maps provide forward only iterators, this means that you can't use --it,
|
||||||
|
it + 3, it1 - it2.
|
||||||
|
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{containers}
|
||||||
*/
|
*/
|
||||||
class wxHashMap
|
class wxHashMap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//@{
|
/**
|
||||||
|
The size parameter is just a hint, the table will resize automatically
|
||||||
|
to preserve performance.
|
||||||
|
*/
|
||||||
|
wxHashMap(size_type size = 10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Copy constructor.
|
Copy constructor.
|
||||||
*/
|
*/
|
||||||
wxHashMap(size_type size = 10);
|
|
||||||
wxHashMap(const wxHashMap& map);
|
wxHashMap(const wxHashMap& map);
|
||||||
//@}
|
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Returns an iterator pointing at the first element of the hash map.
|
Returns an iterator pointing at the first element of the hash map.
|
||||||
Please remember that hash maps do not guarantee ordering.
|
Please remember that hash maps do not guarantee ordering.
|
||||||
*/
|
*/
|
||||||
const_iterator begin();
|
const_iterator begin() const;
|
||||||
const iterator begin();
|
iterator begin();
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,42 +198,51 @@ public:
|
|||||||
Returns an iterator pointing at the one-after-the-last element of the hash map.
|
Returns an iterator pointing at the one-after-the-last element of the hash map.
|
||||||
Please remember that hash maps do not guarantee ordering.
|
Please remember that hash maps do not guarantee ordering.
|
||||||
*/
|
*/
|
||||||
const_iterator end();
|
const_iterator end() const;
|
||||||
const iterator end();
|
iterator end();
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
|
/**
|
||||||
|
Erases the element with the given key, and returns the number of elements
|
||||||
|
erased (either 0 or 1).
|
||||||
|
*/
|
||||||
|
size_type erase(const key_type& key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Erases the element pointed to by the iterator. After the deletion
|
Erases the element pointed to by the iterator. After the deletion
|
||||||
the iterator is no longer valid and must not be used.
|
the iterator is no longer valid and must not be used.
|
||||||
*/
|
*/
|
||||||
size_type erase(const key_type& key);
|
|
||||||
void erase(iterator it);
|
void erase(iterator it);
|
||||||
void erase(const_iterator it);
|
void erase(const_iterator it);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
If an element with the given key is present, the functions returns
|
If an element with the given key is present, the functions returns an
|
||||||
an iterator pointing at that element, otherwise an invalid iterator
|
iterator pointing at that element, otherwise an invalid iterator is
|
||||||
is returned (i.e. hashmap.find( non_existent_key ) == hashmap.end()).
|
returned; i.e.
|
||||||
|
@code
|
||||||
|
hashmap.find( non_existent_key ) == hashmap.end()
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
iterator find(const key_type& key) const;
|
iterator find(const key_type& key) const;
|
||||||
const_iterator find(const key_type& key) const;
|
const_iterator find(const key_type& key) const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Inserts the given value in the hash map. The return value is
|
Inserts the given value in the hash map.
|
||||||
equivalent to a @c std::pairiterator(), bool;
|
The return value is equivalent to a
|
||||||
the iterator points to the inserted element, the boolean value
|
@code std::pair<wxHashMap::iterator, bool> @endcode
|
||||||
is @true if @c v was actually inserted.
|
The iterator points to the inserted element, the boolean value is @true
|
||||||
|
if @a v was actually inserted.
|
||||||
*/
|
*/
|
||||||
Insert_Result insert(const value_type& v);
|
Insert_Result insert(const value_type& v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use the key as an array subscript. The only difference is that if the
|
Use the key as an array subscript.
|
||||||
given key is not present in the hash map, an element with the
|
The only difference is that if the given key is not present in the hash map,
|
||||||
default @c value_type() is inserted in the table.
|
an element with the default @c value_type() is inserted in the table.
|
||||||
*/
|
*/
|
||||||
mapped_type operator[](const key_type& key);
|
mapped_type operator[](const key_type& key);
|
||||||
|
|
||||||
|
@@ -10,31 +10,154 @@
|
|||||||
@class wxHashSet
|
@class wxHashSet
|
||||||
|
|
||||||
This is a simple, type-safe, and reasonably efficient hash set class,
|
This is a simple, type-safe, and reasonably efficient hash set class,
|
||||||
whose interface is a subset of the interface of STL containers. In
|
whose interface is a subset of the interface of STL containers.
|
||||||
particular, the interface is modeled after std::set, and the various,
|
In particular, the interface is modeled after std::set, and the various,
|
||||||
non-standard, std::hash_map.
|
non-standard, std::hash_map.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
class MyClass { ... };
|
||||||
|
|
||||||
|
// same, with MyClass* keys (only uses pointer equality!)
|
||||||
|
WX_DECLARE_HASH_SET( MyClass*, wxPointerHash, wxPointerEqual, MySet1 );
|
||||||
|
// same, with int keys
|
||||||
|
WX_DECLARE_HASH_SET( int, wxIntegerHash, wxIntegerEqual, MySet2 );
|
||||||
|
// declare a hash set with string keys
|
||||||
|
WX_DECLARE_HASH_SET( wxString, wxStringHash, wxStringEqual, MySet3 );
|
||||||
|
|
||||||
|
MySet1 h1;
|
||||||
|
MySet2 h1;
|
||||||
|
MySet3 h3;
|
||||||
|
|
||||||
|
// store and retrieve values
|
||||||
|
h1.insert( new MyClass( 1 ) );
|
||||||
|
|
||||||
|
h3.insert( "foo" );
|
||||||
|
h3.insert( "bar" );
|
||||||
|
h3.insert( "baz" );
|
||||||
|
|
||||||
|
int size = h3.size(); // now is three
|
||||||
|
bool has_foo = h3.find( "foo" ) != h3.end();
|
||||||
|
|
||||||
|
h3.insert( "bar" ); // still has size three
|
||||||
|
|
||||||
|
// iterate over all the elements in the class
|
||||||
|
MySet3::iterator it;
|
||||||
|
for( it = h3.begin(); it != h3.end(); ++it )
|
||||||
|
{
|
||||||
|
wxString key = *it;
|
||||||
|
// do something useful with key
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@section hashset_declaringnew Declaring new hash set types
|
||||||
|
|
||||||
|
@code
|
||||||
|
WX_DECLARE_HASH_SET( KEY_T, // type of the keys
|
||||||
|
HASH_T, // hasher
|
||||||
|
KEY_EQ_T, // key equality predicate
|
||||||
|
CLASSNAME); // name of the class
|
||||||
|
@endcode
|
||||||
|
The HASH_T and KEY_EQ_T are the types used for the hashing function and key
|
||||||
|
comparison. wxWidgets provides three predefined hashing functions:
|
||||||
|
wxIntegerHash for integer types ( int, long, short, and their unsigned counterparts ),
|
||||||
|
wxStringHash for strings ( wxString, wxChar*, char* ), and wxPointerHash for
|
||||||
|
any kind of pointer.
|
||||||
|
Similarly three equality predicates: wxIntegerEqual, wxStringEqual, wxPointerEqual
|
||||||
|
are provided. Using this you could declare a hash set using int values like this:
|
||||||
|
|
||||||
|
@code
|
||||||
|
WX_DECLARE_HASH_SET( int,
|
||||||
|
wxIntegerHash,
|
||||||
|
wxIntegerEqual,
|
||||||
|
MySet );
|
||||||
|
|
||||||
|
// using an user-defined class for keys
|
||||||
|
class MyKey { ... };
|
||||||
|
|
||||||
|
// hashing function
|
||||||
|
class MyKeyHash
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyKeyHash() { }
|
||||||
|
|
||||||
|
unsigned long operator()( const MyKey& k ) const
|
||||||
|
{
|
||||||
|
// compute the hash
|
||||||
|
}
|
||||||
|
|
||||||
|
MyKeyHash& operator=(const MyKeyHash&) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// comparison operator
|
||||||
|
class MyKeyEqual
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyKeyEqual() { }
|
||||||
|
bool operator()( const MyKey& a, const MyKey& b ) const
|
||||||
|
{
|
||||||
|
// compare for equality
|
||||||
|
}
|
||||||
|
|
||||||
|
MyKeyEqual& operator=(const MyKeyEqual&) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
|
WX_DECLARE_HASH_SET( MyKey, // type of the keys
|
||||||
|
MyKeyHash, // hasher
|
||||||
|
MyKeyEqual, // key equality predicate
|
||||||
|
CLASSNAME); // name of the class
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
@section hashset_types Types
|
||||||
|
|
||||||
|
In the documentation below you should replace wxHashSet with the name you
|
||||||
|
used in the class declaration.
|
||||||
|
|
||||||
|
- wxHashSet::key_type: Type of the hash keys
|
||||||
|
- wxHashSet::mapped_type: Type of hash keys
|
||||||
|
- wxHashSet::value_type: Type of hash keys
|
||||||
|
- wxHashSet::iterator: Used to enumerate all the elements in a hash set;
|
||||||
|
it is similar to a value_type*
|
||||||
|
- wxHashSet::const_iterator: Used to enumerate all the elements in a constant
|
||||||
|
hash set; it is similar to a const value_type*
|
||||||
|
- wxHashSet::size_type: Used for sizes
|
||||||
|
- wxHashSet::Insert_Result: The return value for insert()
|
||||||
|
|
||||||
|
|
||||||
|
@section hashset_iter Iterators
|
||||||
|
|
||||||
|
An iterator is similar to a pointer, and so you can use the usual pointer
|
||||||
|
operations: ++it ( and it++ ) to move to the next element, *it to access the
|
||||||
|
element pointed to, *it to access the value of the element pointed to.
|
||||||
|
Hash sets provide forward only iterators, this means that you can't use --it,
|
||||||
|
it + 3, it1 - it2.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{containers}
|
||||||
*/
|
*/
|
||||||
class wxHashSet
|
class wxHashSet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//@{
|
/**
|
||||||
|
The size parameter is just a hint, the table will resize automatically
|
||||||
|
to preserve performance.
|
||||||
|
*/
|
||||||
|
wxHashSet(size_type size = 10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Copy constructor.
|
Copy constructor.
|
||||||
*/
|
*/
|
||||||
wxHashSet(size_type size = 10);
|
|
||||||
wxHashSet(const wxHashSet& set);
|
wxHashSet(const wxHashSet& set);
|
||||||
//@}
|
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Returns an iterator pointing at the first element of the hash set.
|
Returns an iterator pointing at the first element of the hash set.
|
||||||
Please remember that hash sets do not guarantee ordering.
|
Please remember that hash sets do not guarantee ordering.
|
||||||
*/
|
*/
|
||||||
const_iterator begin();
|
const_iterator begin() const;
|
||||||
const iterator begin();
|
iterator begin();
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,16 +181,21 @@ public:
|
|||||||
Returns an iterator pointing at the one-after-the-last element of the hash set.
|
Returns an iterator pointing at the one-after-the-last element of the hash set.
|
||||||
Please remember that hash sets do not guarantee ordering.
|
Please remember that hash sets do not guarantee ordering.
|
||||||
*/
|
*/
|
||||||
const_iterator end();
|
const_iterator end() const;
|
||||||
const iterator end();
|
iterator end();
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Erases the element with the given key, and returns the number of elements
|
||||||
|
erased (either 0 or 1).
|
||||||
|
*/
|
||||||
|
size_type erase(const key_type& key);
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Erases the element pointed to by the iterator. After the deletion
|
Erases the element pointed to by the iterator. After the deletion
|
||||||
the iterator is no longer valid and must not be used.
|
the iterator is no longer valid and must not be used.
|
||||||
*/
|
*/
|
||||||
size_type erase(const key_type& key);
|
|
||||||
void erase(iterator it);
|
void erase(iterator it);
|
||||||
void erase(const_iterator it);
|
void erase(const_iterator it);
|
||||||
//@}
|
//@}
|
||||||
@@ -76,17 +204,21 @@ public:
|
|||||||
/**
|
/**
|
||||||
If an element with the given key is present, the functions returns
|
If an element with the given key is present, the functions returns
|
||||||
an iterator pointing at that element, otherwise an invalid iterator
|
an iterator pointing at that element, otherwise an invalid iterator
|
||||||
is returned (i.e. hashset.find( non_existent_key ) == hashset.end()).
|
is returned; i.e.
|
||||||
|
@code
|
||||||
|
hashset.find( non_existent_key ) == hashset.end()
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
iterator find(const key_type& key) const;
|
iterator find(const key_type& key) const;
|
||||||
const_iterator find(const key_type& key) const;
|
const_iterator find(const key_type& key) const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Inserts the given value in the hash set. The return value is
|
Inserts the given value in the hash set.
|
||||||
equivalent to a @c std::pairwxHashMap::iterator, bool;
|
The return value is equivalent to a
|
||||||
the iterator points to the inserted element, the boolean value
|
@code std::pair<wxHashMap::iterator, bool> @endcode
|
||||||
is @true if @c v was actually inserted.
|
The iterator points to the inserted element, the boolean value is @true
|
||||||
|
if @a v was actually inserted.
|
||||||
*/
|
*/
|
||||||
Insert_Result insert(const value_type& v);
|
Insert_Result insert(const value_type& v);
|
||||||
|
|
||||||
|
@@ -9,81 +9,71 @@
|
|||||||
/**
|
/**
|
||||||
@class wxHelpController
|
@class wxHelpController
|
||||||
|
|
||||||
This is a family of classes by which
|
This is a family of classes by which applications may invoke a help viewer
|
||||||
applications may invoke a help viewer to provide on-line help.
|
to provide on-line help.
|
||||||
|
|
||||||
A help controller allows an application to display help, at the contents
|
A help controller allows an application to display help, at the contents
|
||||||
or at a particular topic, and shut the help program down on termination.
|
or at a particular topic, and shut the help program down on termination.
|
||||||
This avoids proliferation of many instances of the help viewer whenever the
|
This avoids proliferation of many instances of the help viewer whenever the
|
||||||
user requests a different topic via the application's menus or buttons.
|
user requests a different topic via the application's menus or buttons.
|
||||||
|
|
||||||
Typically, an application will create a help controller instance
|
Typically, an application will create a help controller instance when it starts,
|
||||||
when it starts, and immediately call @b Initialize
|
and immediately call wxHelpController::Initialize to associate a filename with it.
|
||||||
to associate a filename with it. The help viewer will only get run, however,
|
The help viewer will only get run, however, just before the first call to
|
||||||
just before the first call to display something.
|
display something.
|
||||||
|
|
||||||
Most help controller classes actually derive from wxHelpControllerBase and have
|
Most help controller classes actually derive from wxHelpControllerBase and have
|
||||||
names of the form wxXXXHelpController or wxHelpControllerXXX. An
|
names of the form wxXXXHelpController or wxHelpControllerXXX.
|
||||||
appropriate class is aliased to the name wxHelpController for each platform, as
|
An appropriate class is aliased to the name wxHelpController for each platform, as
|
||||||
follows:
|
follows:
|
||||||
|
- On desktop Windows, wxCHMHelpController is used (MS HTML Help).
|
||||||
|
- On Windows CE, wxWinceHelpController is used.
|
||||||
|
- On all other platforms, wxHtmlHelpController is used if wxHTML is compiled
|
||||||
|
into wxWidgets; otherwise wxExtHelpController is used (for invoking an
|
||||||
|
external browser).
|
||||||
|
|
||||||
On desktop Windows, wxCHMHelpController is used (MS HTML Help).
|
The remaining help controller classes need to be named explicitly by an
|
||||||
On Windows CE, wxWinceHelpController is used.
|
application that wishes to make use of them.
|
||||||
On all other platforms, wxHtmlHelpController is used if wxHTML is
|
|
||||||
compiled into wxWidgets; otherwise wxExtHelpController is used (for invoking an
|
|
||||||
external
|
|
||||||
browser).
|
|
||||||
|
|
||||||
The remaining help controller classes need to be named
|
|
||||||
explicitly by an application that wishes to make use of them.
|
|
||||||
|
|
||||||
There are currently the following help controller classes defined:
|
There are currently the following help controller classes defined:
|
||||||
|
- wxWinHelpController, for controlling Windows Help.
|
||||||
wxWinHelpController, for controlling Windows Help.
|
- wxCHMHelpController, for controlling MS HTML Help. To use this, you need to
|
||||||
wxCHMHelpController, for controlling MS HTML Help. To use this, you need to
|
set wxUSE_MS_HTML_HELP to 1 in setup.h and have htmlhelp.h header from
|
||||||
set wxUSE_MS_HTML_HELP
|
Microsoft's HTML Help kit (you don't need VC++ specific htmlhelp.lib
|
||||||
to 1 in setup.h and have htmlhelp.h header from Microsoft's HTML Help kit (you
|
because wxWidgets loads necessary DLL at runtime and so it works with all
|
||||||
don't need
|
compilers).
|
||||||
VC++ specific htmlhelp.lib because wxWidgets loads necessary DLL at runtime and
|
- wxBestHelpController, for controlling MS HTML Help or, if Microsoft's runtime
|
||||||
so it
|
is not available, wxHtmlHelpController. You need to provide @b both CHM and
|
||||||
works with all compilers).
|
HTB versions of the help file. For 32bit Windows only.
|
||||||
wxBestHelpController, for controlling MS HTML Help or, if Microsoft's runtime
|
- wxExtHelpController, for controlling external browsers under Unix.
|
||||||
is
|
|
||||||
not available, wxHtmlHelpController. You need to provide
|
|
||||||
@b both CHM and HTB versions of the help file. For 32bit Windows only.
|
|
||||||
wxExtHelpController, for controlling external browsers under Unix.
|
|
||||||
The default browser is Netscape Navigator. The 'help' sample shows its use.
|
The default browser is Netscape Navigator. The 'help' sample shows its use.
|
||||||
wxWinceHelpController, for controlling a simple @c .htm help controller for
|
- wxWinceHelpController, for controlling a simple @c .htm help controller for
|
||||||
Windows CE applications.
|
Windows CE applications.
|
||||||
wxHtmlHelpController, a sophisticated help controller using wxHTML(), in
|
- wxHtmlHelpController, a sophisticated help controller using wxHTML(), in a
|
||||||
a similar style to the Microsoft HTML Help viewer and using some of the same
|
similar style to the Microsoft HTML Help viewer and using some of the same
|
||||||
files.
|
files. Although it has an API compatible with other help controllers, it has
|
||||||
Although it has an API compatible with other help controllers, it has more
|
more advanced features, so it is recommended that you use the specific API
|
||||||
advanced features, so it is
|
for this class instead. Note that if you use .zip or .htb formats for your
|
||||||
recommended that you use the specific API for this class instead. Note that if
|
books, you must add this line to your application initialization:
|
||||||
you
|
@code wxFileSystem::AddHandler(new wxArchiveFSHandler); @endcode
|
||||||
use .zip or .htb formats for your books, you
|
|
||||||
must add this line to your application initialization: @c
|
|
||||||
wxFileSystem::AddHandler(new wxArchiveFSHandler);
|
|
||||||
or nothing will be shown in your help window.
|
or nothing will be shown in your help window.
|
||||||
|
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{help}
|
@category{help}
|
||||||
|
|
||||||
@see wxHtmlHelpController, wxHTML()
|
@see wxHtmlHelpController, @ref overview_html
|
||||||
*/
|
*/
|
||||||
class wxHelpController : public wxObject
|
class wxHelpController : public wxHelpControllerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructs a help instance object, but does not invoke the help viewer.
|
Constructs a help instance object, but does not invoke the help viewer.
|
||||||
If you provide a window, it will be used by some help controller classes, such
|
|
||||||
as
|
If you provide a window, it will be used by some help controller classes, such as
|
||||||
wxCHMHelpController, wxWinHelpController and wxHtmlHelpController, as the
|
wxCHMHelpController, wxWinHelpController and wxHtmlHelpController, as the
|
||||||
parent for the help window instead of the value of wxApp::GetTopWindow. You can
|
parent for the help window instead of the value of wxApp::GetTopWindow.
|
||||||
also change the parent window later with
|
|
||||||
SetParentWindow().
|
You can also change the parent window later with SetParentWindow().
|
||||||
*/
|
*/
|
||||||
wxHelpController(wxWindow* parentWindow = NULL);
|
wxHelpController(wxWindow* parentWindow = NULL);
|
||||||
|
|
||||||
@@ -95,19 +85,21 @@ public:
|
|||||||
/**
|
/**
|
||||||
If the help viewer is not running, runs it and displays the file at the given
|
If the help viewer is not running, runs it and displays the file at the given
|
||||||
block number.
|
block number.
|
||||||
@e WinHelp: Refers to the context number.
|
|
||||||
@e MS HTML Help: Refers to the context number.
|
- @e WinHelp: Refers to the context number.
|
||||||
@e External HTML help: the same as for DisplaySection().
|
- @e MS HTML Help: Refers to the context number.
|
||||||
@e wxHtmlHelpController: @e sectionNo is an identifier as specified in the @c
|
- @e External HTML help: the same as for DisplaySection().
|
||||||
.hhc file. See @ref overview_helpformat "Help files format".
|
- @e wxHtmlHelpController: @e sectionNo is an identifier as specified in
|
||||||
This function is for backward compatibility only, and applications should use
|
the @c .hhc file. See @ref overview_html_helpformats.
|
||||||
@ref displaysection() wxHelpController instead.
|
|
||||||
|
@deprecated
|
||||||
|
This function is for backward compatibility only, and applications
|
||||||
|
should use DisplaySection() instead.
|
||||||
*/
|
*/
|
||||||
virtual bool DisplayBlock(long blockNo);
|
virtual bool DisplayBlock(long blockNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If the help viewer is not running, runs it and displays the
|
If the help viewer is not running, runs it and displays the contents.
|
||||||
contents.
|
|
||||||
*/
|
*/
|
||||||
virtual bool DisplayContents();
|
virtual bool DisplayContents();
|
||||||
|
|
||||||
@@ -117,24 +109,33 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool DisplayContextPopup(int contextId);
|
virtual bool DisplayContextPopup(int contextId);
|
||||||
|
|
||||||
//@{
|
|
||||||
/**
|
/**
|
||||||
If the help viewer is not running, runs it and displays the given section.
|
If the help viewer is not running, runs it and displays the given section.
|
||||||
@e WinHelp, MS HTML Help @a sectionNo is a context id.
|
|
||||||
@e External HTML help: wxExtHelpController implements @a sectionNo as an id in
|
|
||||||
a map file, which is of the form:
|
|
||||||
|
|
||||||
@e wxHtmlHelpController: @a sectionNo is an identifier as specified in the @c
|
The interpretation of section differs between help viewers.
|
||||||
.hhc file. See @ref overview_helpformat "Help files format".
|
For most viewers, this call is equivalent to KeywordSearch.
|
||||||
|
For MS HTML Help, wxHTML help and external HTML help, if section has a
|
||||||
|
.htm or .html extension, that HTML file will be displayed; otherwise a
|
||||||
|
keyword search is done.
|
||||||
|
*/
|
||||||
|
virtual bool DisplaySection(const wxString& section);
|
||||||
|
|
||||||
|
/**
|
||||||
|
If the help viewer is not running, runs it and displays the given section.
|
||||||
|
|
||||||
|
- @e WinHelp, MS HTML Help @a sectionNo is a context id.
|
||||||
|
- @e External HTML help: wxExtHelpController implements @a sectionNo as
|
||||||
|
an id in a map file, which is of the form:
|
||||||
|
- @e wxHtmlHelpController: @a sectionNo is an identifier as specified in
|
||||||
|
the @c .hhc file. See @ref overview_html_helpformats.
|
||||||
See also the help sample for notes on how to specify section numbers for
|
See also the help sample for notes on how to specify section numbers for
|
||||||
various help file formats.
|
various help file formats.
|
||||||
*/
|
*/
|
||||||
virtual bool DisplaySection(const wxString& section);
|
|
||||||
virtual bool DisplaySection(int sectionNo);
|
virtual bool DisplaySection(int sectionNo);
|
||||||
//@}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Displays the text in a popup window, if possible.
|
Displays the text in a popup window, if possible.
|
||||||
|
|
||||||
Returns @false if unsuccessful or not implemented.
|
Returns @false if unsuccessful or not implemented.
|
||||||
*/
|
*/
|
||||||
virtual bool DisplayTextPopup(const wxString& text,
|
virtual bool DisplayTextPopup(const wxString& text,
|
||||||
@@ -142,38 +143,30 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
wxHtmlHelpController returns the frame, size and position.
|
wxHtmlHelpController returns the frame, size and position.
|
||||||
For all other help controllers, this function does nothing
|
For all other help controllers, this function does nothing and just
|
||||||
and just returns @NULL.
|
returns @NULL.
|
||||||
|
|
||||||
@param viewer
|
|
||||||
This defaults to "netscape" for wxExtHelpController.
|
|
||||||
@param flags
|
|
||||||
This defaults to wxHELP_NETSCAPE for wxExtHelpController, indicating
|
|
||||||
that the viewer is a variant of Netscape Navigator.
|
|
||||||
*/
|
*/
|
||||||
virtual wxFrame* GetFrameParameters(const wxSize* size = NULL,
|
virtual wxFrame* GetFrameParameters(const wxSize* size = NULL,
|
||||||
const wxPoint* pos = NULL,
|
const wxPoint* pos = NULL,
|
||||||
bool* newFrameEachTime = NULL);
|
bool* newFrameEachTime = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the window to be used as the parent for the help window. This window is
|
Returns the window to be used as the parent for the help window.
|
||||||
used
|
This window is used by wxCHMHelpController, wxWinHelpController and
|
||||||
by wxCHMHelpController, wxWinHelpController and wxHtmlHelpController.
|
wxHtmlHelpController.
|
||||||
*/
|
*/
|
||||||
virtual wxWindow* GetParentWindow() const;
|
virtual wxWindow* GetParentWindow() const;
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Initializes the help instance with a help filename, and optionally a server
|
Initializes the help instance with a help filename, and optionally a server
|
||||||
socket
|
socket number if using wxHelp (now obsolete). Does not invoke the help viewer.
|
||||||
number if using wxHelp (now obsolete). Does not invoke the help viewer.
|
|
||||||
This must be called directly after the help instance object is created and
|
This must be called directly after the help instance object is created and
|
||||||
before
|
before any attempts to communicate with the viewer.
|
||||||
any attempts to communicate with the viewer.
|
|
||||||
You may omit the file extension and a suitable one will be chosen. For
|
You may omit the file extension and a suitable one will be chosen.
|
||||||
wxHtmlHelpController, the extensions zip, htb and hhp will be appended while
|
For wxHtmlHelpController, the extensions zip, htb and hhp will be appended
|
||||||
searching for
|
while searching for a suitable file. For WinHelp, the hlp extension is appended.
|
||||||
a suitable file. For WinHelp, the hlp extension is appended.
|
|
||||||
*/
|
*/
|
||||||
virtual bool Initialize(const wxString& file);
|
virtual bool Initialize(const wxString& file);
|
||||||
virtual bool Initialize(const wxString& file, int server);
|
virtual bool Initialize(const wxString& file, int server);
|
||||||
@@ -181,26 +174,28 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
If the help viewer is not running, runs it, and searches for sections matching
|
If the help viewer is not running, runs it, and searches for sections matching
|
||||||
the given keyword. If one match is found, the file is displayed at this
|
the given keyword. If one match is found, the file is displayed at this section.
|
||||||
section. The optional parameter allows the search the index
|
The optional parameter allows the search the index (wxHELP_SEARCH_INDEX)
|
||||||
(wxHELP_SEARCH_INDEX) but this currently only supported by the
|
but this currently only supported by the wxHtmlHelpController.
|
||||||
wxHtmlHelpController.
|
|
||||||
@e WinHelp, MS HTML Help: If more than one match is found,
|
- @e WinHelp, MS HTML Help:
|
||||||
the first topic is displayed.
|
If more than one match is found, the first topic is displayed.
|
||||||
@e External HTML help, simple wxHTML help: If more than one match is found,
|
- @e External HTML help, simple wxHTML help:
|
||||||
a choice of topics is displayed.
|
If more than one match is found, a choice of topics is displayed.
|
||||||
@e wxHtmlHelpController: see wxHtmlHelpController::KeywordSearch.
|
- @e wxHtmlHelpController: see wxHtmlHelpController::KeywordSearch.
|
||||||
*/
|
*/
|
||||||
virtual bool KeywordSearch(const wxString& keyWord,
|
virtual bool KeywordSearch(const wxString& keyWord,
|
||||||
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
|
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If the help viewer is not running, runs it and loads the given file.
|
If the help viewer is not running, runs it and loads the given file.
|
||||||
If the filename is not supplied or is
|
If the filename is not supplied or is empty, the file specified in
|
||||||
empty, the file specified in @b Initialize is used. If the viewer is
|
Initialize() is used.
|
||||||
already displaying the specified file, it will not be reloaded. This
|
|
||||||
member function may be used before each display call in case the user
|
If the viewer is already displaying the specified file, it will not be
|
||||||
has opened another file.
|
reloaded. This member function may be used before each display call in
|
||||||
|
case the user has opened another file.
|
||||||
|
|
||||||
wxHtmlHelpController ignores this call.
|
wxHtmlHelpController ignores this call.
|
||||||
*/
|
*/
|
||||||
virtual bool LoadFile(const wxString& file = "");
|
virtual bool LoadFile(const wxString& file = "");
|
||||||
@@ -213,15 +208,15 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
If the viewer is running, quits it by disconnecting.
|
If the viewer is running, quits it by disconnecting.
|
||||||
For Windows Help, the viewer will only close if no other application is using
|
For Windows Help, the viewer will only close if no other application is using it.
|
||||||
it.
|
|
||||||
*/
|
*/
|
||||||
virtual bool Quit();
|
virtual bool Quit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
For wxHtmlHelpController, the title is set (again with %s indicating the
|
For wxHtmlHelpController, the title is set (again with %s indicating the
|
||||||
page title) and also the size and position of the frame if the frame is already
|
page title) and also the size and position of the frame if the frame is
|
||||||
open. @a newFrameEachTime is ignored.
|
already open. @a newFrameEachTime is ignored.
|
||||||
|
|
||||||
For all other help controllers this function has no effect.
|
For all other help controllers this function has no effect.
|
||||||
*/
|
*/
|
||||||
virtual void SetFrameParameters(const wxString& title,
|
virtual void SetFrameParameters(const wxString& title,
|
||||||
@@ -236,9 +231,23 @@ public:
|
|||||||
virtual void SetParentWindow(wxWindow* parentWindow);
|
virtual void SetParentWindow(wxWindow* parentWindow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets detailed viewer information. So far this is only relevant to
|
Sets detailed viewer information.
|
||||||
wxExtHelpController.
|
So far this is only relevant to wxExtHelpController.
|
||||||
Some examples of usage:
|
Some examples of usage:
|
||||||
|
|
||||||
|
@code
|
||||||
|
m_help.SetViewer("kdehelp");
|
||||||
|
m_help.SetViewer("gnome-help-browser");
|
||||||
|
m_help.SetViewer("netscape", wxHELP_NETSCAPE);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@param viewer
|
||||||
|
This defaults to "netscape" for wxExtHelpController.
|
||||||
|
@param flags
|
||||||
|
This defaults to wxHELP_NETSCAPE for wxExtHelpController, indicating
|
||||||
|
that the viewer is a variant of Netscape Navigator.
|
||||||
|
|
||||||
|
@todo modernize this function with ::wxLaunchDefaultBrowser
|
||||||
*/
|
*/
|
||||||
virtual void SetViewer(const wxString& viewer, long flags);
|
virtual void SetViewer(const wxString& viewer, long flags);
|
||||||
};
|
};
|
||||||
|
@@ -9,11 +9,19 @@
|
|||||||
/**
|
/**
|
||||||
@class wxHtmlListBox
|
@class wxHtmlListBox
|
||||||
|
|
||||||
wxHtmlListBox is an implementation of wxVListBox which
|
wxHtmlListBox is an implementation of wxVListBox which shows HTML content in
|
||||||
shows HTML content in the listbox rows. This is still an abstract base class
|
the listbox rows. This is still an abstract base class and you will need to
|
||||||
and you will need to derive your own class from it (see htlbox sample for the
|
derive your own class from it (see htlbox sample for the example) but you will
|
||||||
example) but you will only need to override a single
|
only need to override a single wxHtmlListBox::OnGetItem function.
|
||||||
wxHtmlListBox::OnGetItem function.
|
|
||||||
|
@beginEventTable{wxHtmlCellEvent,wxHtmlLinkEvent}
|
||||||
|
@event{EVT_HTML_CELL_CLICKED(id, func)}
|
||||||
|
A wxHtmlCell was clicked.
|
||||||
|
@event{EVT_HTML_CELL_HOVER(id, func)}
|
||||||
|
The mouse passed over a wxHtmlCell.
|
||||||
|
@event{EVT_HTML_LINK_CLICKED(id, func)}
|
||||||
|
A wxHtmlCell which contains an hyperlink was clicked.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
@library{wxhtml}
|
@library{wxhtml}
|
||||||
@category{ctrl}
|
@category{ctrl}
|
||||||
@@ -24,18 +32,19 @@
|
|||||||
class wxHtmlListBox : public wxVListBox
|
class wxHtmlListBox : public wxVListBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//@{
|
|
||||||
/**
|
/**
|
||||||
Default constructor, you must call Create()
|
Normal constructor which calls Create() internally.
|
||||||
later.
|
|
||||||
*/
|
*/
|
||||||
wxHtmlListBox(wxWindow* parent, wxWindowID id = wxID_ANY,
|
wxHtmlListBox(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxString& name = wxHtmlListBoxNameStr);
|
const wxString& name = wxHtmlListBoxNameStr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Default constructor, you must call Create() later.
|
||||||
|
*/
|
||||||
wxHtmlListBox();
|
wxHtmlListBox();
|
||||||
//@}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor cleans up whatever resources we use.
|
Destructor cleans up whatever resources we use.
|
||||||
@@ -44,10 +53,11 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Creates the control and optionally sets the initial number of items in it
|
Creates the control and optionally sets the initial number of items in it
|
||||||
(it may also be set or changed later with
|
(it may also be set or changed later with wxVListBox::SetItemCount).
|
||||||
wxVListBox::SetItemCount).
|
|
||||||
There are no special styles defined for wxHtmlListBox, in particular the
|
There are no special styles defined for wxHtmlListBox, in particular the
|
||||||
wxListBox styles (with the exception of @c wxLB_MULTIPLE) can not be used here.
|
wxListBox styles (with the exception of @c wxLB_MULTIPLE) can not be used here.
|
||||||
|
|
||||||
Returns @true on success or @false if the control couldn't be created
|
Returns @true on success or @false if the control couldn't be created
|
||||||
*/
|
*/
|
||||||
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||||
@@ -58,14 +68,15 @@ public:
|
|||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Returns the wxFileSystem used by the HTML parser of
|
Returns the wxFileSystem used by the HTML parser of this object.
|
||||||
this object. The file system object is used to resolve the paths in HTML
|
|
||||||
fragments displayed in the control and you should use
|
The file system object is used to resolve the paths in HTML fragments
|
||||||
wxFileSystem::ChangePathTo if you use
|
displayed in the control and you should use wxFileSystem::ChangePathTo
|
||||||
relative paths for the images or other resources embedded in your HTML.
|
if you use relative paths for the images or other resources embedded in
|
||||||
|
your HTML.
|
||||||
*/
|
*/
|
||||||
wxFileSystem GetFileSystem() const;
|
wxFileSystem& GetFileSystem() const;
|
||||||
const wxFileSystem GetFileSystem() const;
|
const wxFileSystem& GetFileSystem() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -85,12 +96,11 @@ protected:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
This virtual function may be overridden to change the appearance of the
|
This virtual function may be overridden to change the appearance of the
|
||||||
background of the selected cells in the same way as
|
background of the selected cells in the same way as GetSelectedTextColour().
|
||||||
GetSelectedTextColour().
|
|
||||||
It should be rarely, if ever, used because
|
It should be rarely, if ever, used because wxVListBox::SetSelectionBackground
|
||||||
wxVListBox::SetSelectionBackground allows to
|
allows to change the selection background for all cells at once and doing
|
||||||
change the selection background for all cells at once and doing anything more
|
anything more fancy is probably going to look strangely.
|
||||||
fancy is probably going to look strangely.
|
|
||||||
|
|
||||||
@see GetSelectedTextColour()
|
@see GetSelectedTextColour()
|
||||||
*/
|
*/
|
||||||
@@ -117,13 +127,13 @@ protected:
|
|||||||
This method must be implemented in the derived class and should return
|
This method must be implemented in the derived class and should return
|
||||||
the body (i.e. without @c html nor @c body tags) of the HTML fragment
|
the body (i.e. without @c html nor @c body tags) of the HTML fragment
|
||||||
for the given item.
|
for the given item.
|
||||||
|
|
||||||
Note that this function should always return a text fragment for the @a n item
|
Note that this function should always return a text fragment for the @a n item
|
||||||
which renders with the same height both when it is selected and when it's not:
|
which renders with the same height both when it is selected and when it's not:
|
||||||
i.e. if you call, inside your OnGetItem() implementation, @c IsSelected(n) to
|
i.e. if you call, inside your OnGetItem() implementation, @c IsSelected(n) to
|
||||||
make the items appear differently when they are selected, then you should make
|
make the items appear differently when they are selected, then you should make
|
||||||
sure
|
sure that the returned HTML fragment will render with the same height or else
|
||||||
that the returned HTML fragment will render with the same height or else you'll
|
you'll see some artifacts when the user selects an item.
|
||||||
see some artifacts when the user selects an item.
|
|
||||||
*/
|
*/
|
||||||
virtual wxString OnGetItem(size_t n) const = 0;
|
virtual wxString OnGetItem(size_t n) const = 0;
|
||||||
};
|
};
|
||||||
@@ -136,44 +146,62 @@ protected:
|
|||||||
wxSimpleHtmlListBox is an implementation of wxHtmlListBox which
|
wxSimpleHtmlListBox is an implementation of wxHtmlListBox which
|
||||||
shows HTML content in the listbox rows.
|
shows HTML content in the listbox rows.
|
||||||
|
|
||||||
Unlike wxHtmlListBox, this is not an abstract class and thus it
|
Unlike wxHtmlListBox, this is not an abstract class and thus it has the
|
||||||
has the advantage that you can use it without deriving your own class from it.
|
advantage that you can use it without deriving your own class from it.
|
||||||
However, it also has the disadvantage that this is not a virtual control and
|
However, it also has the disadvantage that this is not a virtual control and
|
||||||
thus it's not
|
thus it's not well-suited for those cases where you need to show a huge number
|
||||||
well-suited for those cases where you need to show a huge number of items:
|
of items: every time you add/insert a string, it will be stored internally
|
||||||
every time you
|
and thus will take memory.
|
||||||
add/insert a string, it will be stored internally and thus will take memory.
|
|
||||||
|
|
||||||
The interface exposed by wxSimpleHtmlListBox fully implements the
|
The interface exposed by wxSimpleHtmlListBox fully implements the
|
||||||
wxControlWithItems interface, thus you should refer to
|
wxControlWithItems interface, thus you should refer to wxControlWithItems's
|
||||||
wxControlWithItems's documentation for the API reference
|
documentation for the API reference for adding/removing/retrieving items in
|
||||||
for adding/removing/retrieving items in the listbox.
|
the listbox. Also note that the wxVListBox::SetItemCount function is
|
||||||
Also note that the wxVListBox::SetItemCount function is
|
|
||||||
@c protected in wxSimpleHtmlListBox's context so that you cannot call it
|
@c protected in wxSimpleHtmlListBox's context so that you cannot call it
|
||||||
directly,
|
directly, wxSimpleHtmlListBox will do it for you.
|
||||||
wxSimpleHtmlListBox will do it for you.
|
|
||||||
|
|
||||||
Note: in case you need to append a lot of items to the control at once, make
|
Note: in case you need to append a lot of items to the control at once, make
|
||||||
sure to use the
|
sure to use the
|
||||||
@ref wxControlWithItems::append "Append(const wxArrayString )" function.
|
@ref wxControlWithItems::Append "Append(const wxArrayString&)" function.
|
||||||
|
|
||||||
Thus the only difference between a wxListBox and a wxSimpleHtmlListBox
|
Thus the only difference between a wxListBox and a wxSimpleHtmlListBox
|
||||||
is that the latter stores strings which can contain HTML fragments (see the
|
is that the latter stores strings which can contain HTML fragments (see the
|
||||||
list of
|
list of @ref overview_html_supptags "tags supported by wxHTML").
|
||||||
@ref overview_htmltagssupported "tags supported by wxHTML").
|
|
||||||
|
|
||||||
Note that the HTML strings you fetch to wxSimpleHtmlListBox should not contain
|
Note that the HTML strings you fetch to wxSimpleHtmlListBox should not contain
|
||||||
the @c html
|
the @c \<html\> or @c \<body\> tags.
|
||||||
or @c body tags.
|
|
||||||
|
|
||||||
@beginStyleTable
|
@beginStyleTable
|
||||||
@style{wxHLB_DEFAULT_STYLE}
|
@style{wxHLB_DEFAULT_STYLE}
|
||||||
The default style: wxBORDER_SUNKEN
|
The default style: wxBORDER_SUNKEN
|
||||||
@style{wxHLB_MULTIPLE}
|
@style{wxHLB_MULTIPLE}
|
||||||
Multiple-selection list: the user can toggle multiple items on and
|
Multiple-selection list: the user can toggle multiple items on and off.
|
||||||
off.
|
|
||||||
@endStyleTable
|
@endStyleTable
|
||||||
|
|
||||||
|
|
||||||
|
A wxSimpleHtmlListBox emits the same events used by wxListBox and by wxHtmlListBox.
|
||||||
|
|
||||||
|
@beginEventTable{wxCommandEvent}
|
||||||
|
@event{EVT_LISTBOX(id, func)}
|
||||||
|
Process a wxEVT_COMMAND_LISTBOX_SELECTED event, when an item on the list
|
||||||
|
is selected.
|
||||||
|
@event{EVT_LISTBOX_DCLICK(id, func)}
|
||||||
|
Process a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event, when the listbox is
|
||||||
|
double-clicked.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@beginEventTable{wxHtmlCellEvent}
|
||||||
|
@event{EVT_HTML_CELL_CLICKED(id, func)}
|
||||||
|
A wxHtmlCell was clicked.
|
||||||
|
@event{EVT_HTML_CELL_HOVER(id, func)}
|
||||||
|
The mouse passed over a wxHtmlCell.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@beginEventTable{wxHtmlLinkEvent}
|
||||||
|
@event{EVT_HTML_LINK_CLICKED(id, func)}
|
||||||
|
A wxHtmlCell which contains an hyperlink was clicked.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
@library{wxhtml}
|
@library{wxhtml}
|
||||||
@category{ctrl}
|
@category{ctrl}
|
||||||
@appearance{simplehtmllistbox.png}
|
@appearance{simplehtmllistbox.png}
|
||||||
@@ -183,10 +211,27 @@ protected:
|
|||||||
class wxSimpleHtmlListBox : public wxHtmlListBox
|
class wxSimpleHtmlListBox : public wxHtmlListBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//@{
|
|
||||||
/**
|
/**
|
||||||
Default constructor, you must call Create()
|
Constructor, creating and showing the HTML list box.
|
||||||
later.
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be NULL.
|
||||||
|
@param id
|
||||||
|
Window identifier. A value of -1 indicates a default value.
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the window is sized appropriately.
|
||||||
|
@param n
|
||||||
|
Number of strings with which to initialise the control.
|
||||||
|
@param choices
|
||||||
|
An array of strings with which to initialise the control.
|
||||||
|
@param style
|
||||||
|
Window style. See wxHLB_* flags.
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
*/
|
*/
|
||||||
wxHtmlListBox(wxWindow* parent, wxWindowID id,
|
wxHtmlListBox(wxWindow* parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -196,6 +241,27 @@ public:
|
|||||||
long style = wxHLB_DEFAULT_STYLE,
|
long style = wxHLB_DEFAULT_STYLE,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = "simpleHtmlListBox");
|
const wxString& name = "simpleHtmlListBox");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing the HTML list box.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be NULL.
|
||||||
|
@param id
|
||||||
|
Window identifier. A value of -1 indicates a default value.
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the window is sized appropriately.
|
||||||
|
@param choices
|
||||||
|
An array of strings with which to initialise the control.
|
||||||
|
@param style
|
||||||
|
Window style. See wxHLB_* flags.
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
*/
|
||||||
wxHtmlListBox(wxWindow* parent, wxWindowID id,
|
wxHtmlListBox(wxWindow* parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
@@ -203,11 +269,11 @@ public:
|
|||||||
long style = wxHLB_DEFAULT_STYLE,
|
long style = wxHLB_DEFAULT_STYLE,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = "simpleHtmlListBox");
|
const wxString& name = "simpleHtmlListBox");
|
||||||
See also
|
|
||||||
wxSimpleHtmlListBox::Create
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Default constructor, you must call Create() later.
|
||||||
|
*/
|
||||||
wxSimpleHtmlListBox();
|
wxSimpleHtmlListBox();
|
||||||
//@}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Frees the array of stored items and relative client data.
|
Frees the array of stored items and relative client data.
|
||||||
|
@@ -9,11 +9,15 @@
|
|||||||
/**
|
/**
|
||||||
@class wxHyperlinkEvent
|
@class wxHyperlinkEvent
|
||||||
|
|
||||||
This event class is used for the events generated by
|
This event class is used for the events generated by wxHyperlinkCtrl.
|
||||||
wxHyperlinkCtrl.
|
|
||||||
|
@beginEventTable{wxHyperlinkEvent}
|
||||||
|
@event{EVT_HYPERLINK(id, func)}
|
||||||
|
User clicked on an hyperlink.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
@library{wxadv}
|
@library{wxadv}
|
||||||
@category{FIXME}
|
@category{events}
|
||||||
*/
|
*/
|
||||||
class wxHyperlinkEvent : public wxCommandEvent
|
class wxHyperlinkEvent : public wxCommandEvent
|
||||||
{
|
{
|
||||||
@@ -21,8 +25,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
The constructor is not normally used by the user code.
|
The constructor is not normally used by the user code.
|
||||||
*/
|
*/
|
||||||
wxHyperlinkEvent(wxObject* generator, int id,
|
wxHyperlinkEvent(wxObject* generator, int id, const wxString& url);
|
||||||
const wxString& url);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the URL of the hyperlink where the user has just clicked.
|
Returns the URL of the hyperlink where the user has just clicked.
|
||||||
@@ -41,15 +44,15 @@ public:
|
|||||||
@class wxHyperlinkCtrl
|
@class wxHyperlinkCtrl
|
||||||
|
|
||||||
This class shows a static text element which links to an URL.
|
This class shows a static text element which links to an URL.
|
||||||
Appearance and behaviour is completely customizable. In fact, when the user
|
Appearance and behaviour is completely customizable.
|
||||||
clicks on the hyperlink, a wxHyperlinkEvent is
|
|
||||||
sent but if that event is not handled (or it's skipped; see
|
In fact, when the user clicks on the hyperlink, a wxHyperlinkEvent is
|
||||||
wxEvent::Skip), then a call to
|
sent but if that event is not handled (or it's skipped; see wxEvent::Skip),
|
||||||
wxLaunchDefaultBrowser() is done with the
|
then a call to wxLaunchDefaultBrowser() is done with the hyperlink's URL.
|
||||||
hyperlink's URL.
|
|
||||||
|
|
||||||
Note that standard wxWindow functions like wxWindow::SetBackgroundColour,
|
Note that standard wxWindow functions like wxWindow::SetBackgroundColour,
|
||||||
wxWindow::SetFont, wxWindow::SetCursor, wxWindow::SetLabel can be used to customize appearance of the hyperlink.
|
wxWindow::SetFont, wxWindow::SetCursor, wxWindow::SetLabel can be used to
|
||||||
|
customize appearance of the hyperlink.
|
||||||
|
|
||||||
@beginStyleTable
|
@beginStyleTable
|
||||||
@style{wxHL_ALIGN_LEFT}
|
@style{wxHL_ALIGN_LEFT}
|
||||||
@@ -68,6 +71,14 @@ public:
|
|||||||
wxBORDER_NONE|wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE.
|
wxBORDER_NONE|wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE.
|
||||||
@endStyleTable
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable{wxHyperlinkEvent}
|
||||||
|
@event{EVT_HYPERLINK(id, func)}
|
||||||
|
The hyperlink was (left) clicked. If this event is not handled in user's
|
||||||
|
code (or it's skipped; see wxEvent::Skip), then a call to wxLaunchDefaultBrowser
|
||||||
|
is done with the hyperlink's URL.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
|
||||||
@library{wxadv}
|
@library{wxadv}
|
||||||
@category{ctrl}
|
@category{ctrl}
|
||||||
@appearance{hyperlinkctrl.png}
|
@appearance{hyperlinkctrl.png}
|
||||||
@@ -102,12 +113,10 @@ public:
|
|||||||
@param pos
|
@param pos
|
||||||
Window position.
|
Window position.
|
||||||
@param size
|
@param size
|
||||||
Window size. If the wxDefaultSize is specified then the window is sized
|
Window size.
|
||||||
appropriately.
|
If the wxDefaultSize is specified then the window is sized appropriately.
|
||||||
@param style
|
@param style
|
||||||
Window style. See wxHyperlinkCtrl.
|
Window style. See wxHyperlinkCtrl.
|
||||||
@param validator
|
|
||||||
Window validator.
|
|
||||||
@param name
|
@param name
|
||||||
Window name.
|
Window name.
|
||||||
*/
|
*/
|
||||||
@@ -125,8 +134,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the colour used to print the label when the link has never been clicked
|
Returns the colour used to print the label when the link has never been clicked
|
||||||
before
|
before (i.e. the link has not been @e visited) and the mouse is not over the control.
|
||||||
(i.e. the link has not been @e visited) and the mouse is not over the control.
|
|
||||||
*/
|
*/
|
||||||
virtual wxColour GetNormalColour() const;
|
virtual wxColour GetNormalColour() const;
|
||||||
|
|
||||||
@@ -143,9 +151,8 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the colour used to print the label when the mouse is not over the
|
Returns the colour used to print the label when the mouse is not over the
|
||||||
control
|
control and the link has already been clicked before (i.e. the link has
|
||||||
and the link has already been clicked before (i.e. the link has been @e
|
been @e visited).
|
||||||
visited).
|
|
||||||
*/
|
*/
|
||||||
virtual wxColour GetVisitedColour() const;
|
virtual wxColour GetVisitedColour() const;
|
||||||
|
|
||||||
@@ -156,8 +163,7 @@ public:
|
|||||||
virtual void SetHoverColour(const wxColour& colour);
|
virtual void SetHoverColour(const wxColour& colour);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the colour used to print the label when the link has never been clicked
|
Sets the colour used to print the label when the link has never been clicked before
|
||||||
before
|
|
||||||
(i.e. the link has not been @e visited) and the mouse is not over the control.
|
(i.e. the link has not been @e visited) and the mouse is not over the control.
|
||||||
*/
|
*/
|
||||||
virtual void SetNormalColour(const wxColour& colour);
|
virtual void SetNormalColour(const wxColour& colour);
|
||||||
@@ -174,8 +180,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the colour used to print the label when the mouse is not over the control
|
Sets the colour used to print the label when the mouse is not over the control
|
||||||
and the link has already been clicked before (i.e. the link has been @e
|
and the link has already been clicked before (i.e. the link has been @e visited).
|
||||||
visited).
|
|
||||||
*/
|
*/
|
||||||
virtual void SetVisitedColour(const wxColour& colour);
|
virtual void SetVisitedColour(const wxColour& colour);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user