author | drw <drw> | 2003-02-16 21:54:23 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-16 21:54:23 (UTC) |
commit | 8ecc375c803dc57b160bd0335891fcaf4f6de1df (patch) (unidiff) | |
tree | a89c1ccc6e3a469bb8fa435dfedce9386333cb72 /libopie/otabinfo.h | |
parent | e0eb3f016d7f8a1e1e5548ef8aa115fef8999697 (diff) | |
download | opie-8ecc375c803dc57b160bd0335891fcaf4f6de1df.zip opie-8ecc375c803dc57b160bd0335891fcaf4f6de1df.tar.gz opie-8ecc375c803dc57b160bd0335891fcaf4f6de1df.tar.bz2 |
Added changeTab() to OTabWidget to dynamically change tab name and/or icon (stumbled upon request for this in TinyKate todo)
-rw-r--r-- | libopie/otabinfo.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libopie/otabinfo.h b/libopie/otabinfo.h index 8dbbcc2..6589638 100644 --- a/libopie/otabinfo.h +++ b/libopie/otabinfo.h | |||
@@ -44,73 +44,89 @@ class QWidget; | |||
44 | * | 44 | * |
45 | * OTabInfo provides the following information about a widget added to an | 45 | * OTabInfo provides the following information about a widget added to an |
46 | * OTabWidget control: | 46 | * OTabWidget control: |
47 | * | 47 | * |
48 | * ID - integer tab bar ID | 48 | * ID - integer tab bar ID |
49 | * Control - QWidget pointer to child widget | 49 | * Control - QWidget pointer to child widget |
50 | * Label - QString text label for OTabWidget selection control | 50 | * Label - QString text label for OTabWidget selection control |
51 | * Icon - QString name of icon file | 51 | * Icon - QString name of icon file |
52 | */ | 52 | */ |
53 | class OTabInfo | 53 | class OTabInfo |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | /** | 56 | /** |
57 | * @fn OTabInfo() | 57 | * @fn OTabInfo() |
58 | * @brief Object constructor. | 58 | * @brief Object constructor. |
59 | * | 59 | * |
60 | * @param parent Pointer to parent of this control. | 60 | * @param parent Pointer to parent of this control. |
61 | * @param name Name of control. | 61 | * @param name Name of control. |
62 | * @param s Style of widget selection control. | 62 | * @param s Style of widget selection control. |
63 | * @param p Position of the widget selection control. | 63 | * @param p Position of the widget selection control. |
64 | */ | 64 | */ |
65 | OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {} | 65 | OTabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {} |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) | 68 | * @fn OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) |
69 | * @brief Object constructor. | 69 | * @brief Object constructor. |
70 | * | 70 | * |
71 | * @param id TabBar identifier for widget. | 71 | * @param id TabBar identifier for widget. |
72 | * @param control QWidget pointer to widget. | 72 | * @param control QWidget pointer to widget. |
73 | * @param icon QString name of icon file. | 73 | * @param icon QString name of icon file. |
74 | * @param label QString text label for OTabWidget selection control. | 74 | * @param label QString text label for OTabWidget selection control. |
75 | */ | 75 | */ |
76 | OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) | 76 | OTabInfo( int id, QWidget *control, const QString &icon, const QString &label ) |
77 | : i( id ), c( control ), p( icon ), l( label ) {} | 77 | : i( id ), c( control ), p( icon ), l( label ) {} |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * @fn id() | 80 | * @fn id() |
81 | * @brief Returns TabBar ID. | 81 | * @brief Returns TabBar ID. |
82 | */ | 82 | */ |
83 | int id() const { return i; } | 83 | int id() const { return i; } |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * @fn label() | 86 | * @fn label() |
87 | * @brief Returns text label for widget. | 87 | * @brief Returns text label for widget. |
88 | */ | 88 | */ |
89 | const QString &label() const { return l; } | 89 | const QString &label() const { return l; } |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * @fn setLabel( const QString &label ) | ||
93 | * @brief Set label for tab. | ||
94 | * | ||
95 | * @param label QString text label for OTabWidget selection control. | ||
96 | */ | ||
97 | void setLabel( const QString &label ) { l = label; } | ||
98 | |||
99 | /** | ||
92 | * @fn control() | 100 | * @fn control() |
93 | * @brief Returns pointer to widget. | 101 | * @brief Returns pointer to widget. |
94 | */ | 102 | */ |
95 | QWidget *control() const { return c; } | 103 | QWidget *control() const { return c; } |
96 | 104 | ||
97 | /** | 105 | /** |
98 | * @fn icon() | 106 | * @fn icon() |
99 | * @brief Returns name of icon file. | 107 | * @brief Returns name of icon file. |
100 | */ | 108 | */ |
101 | const QString &icon() const { return p; } | 109 | const QString &icon() const { return p; } |
102 | 110 | ||
111 | /** | ||
112 | * @fn setIcon( const QString &icon ) | ||
113 | * @brief Set icon for tab. | ||
114 | * | ||
115 | * @param icon QString name of icon file. | ||
116 | */ | ||
117 | void setIcon( const QString &icon ) { p = icon; } | ||
118 | |||
103 | private: | 119 | private: |
104 | int i; | 120 | int i; |
105 | QWidget *c; | 121 | QWidget *c; |
106 | QString p; | 122 | QString p; |
107 | QString l; | 123 | QString l; |
108 | }; | 124 | }; |
109 | 125 | ||
110 | /** | 126 | /** |
111 | * @class OTabInfoList | 127 | * @class OTabInfoList |
112 | * @brief A list of OTabInfo objects used by OTabWidget. | 128 | * @brief A list of OTabInfo objects used by OTabWidget. |
113 | */ | 129 | */ |
114 | typedef QList<OTabInfo> OTabInfoList; | 130 | typedef QList<OTabInfo> OTabInfoList; |
115 | 131 | ||
116 | #endif | 132 | #endif |