00001 /* 00002 File : actionbutton_b.h 00003 Date : 19-Sep-02 00004 Description : Base class to represent an action button toolbox gadget. 00005 00006 Copyright © 1995-2002 Alexander Thoukydides 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00021 */ 00022 00023 // Only include header file once 00024 #ifndef actionbutton_b_h 00025 #define actionbutton_b_h 00026 00027 // Include oslib header files 00028 #include "oslib/actionbutton.h" 00029 00030 // Include alexlib header files 00031 #ifndef gadget_b_h 00032 #include "gadget_b.h" 00033 #endif 00034 #ifndef gadget_w_event_h 00035 #include "gadget_w_event.h" 00036 #endif 00037 #ifndef gadget_w_text_h 00038 #include "gadget_w_text.h" 00039 #endif 00040 00041 // A base class to represent an action button gadget 00042 class actionbutton_b : public virtual gadget_b, 00043 public gadget_w_event, 00044 public gadget_w_text 00045 { 00046 public: 00047 00048 /* 00049 Parameters : def - The Default action button status. 00050 Returns : void 00051 Description : Set the Default status for this action button. 00052 */ 00053 void set_is_default(bool def = TRUE); 00054 00055 /* 00056 Parameters : void 00057 Returns : bool - The Default action button status. 00058 Description : Get the Default status for this action button. 00059 */ 00060 bool get_is_default() const; 00061 00062 /* 00063 Parameters : cancel - The Cancel action button status. 00064 Returns : void 00065 Description : Set the Cancel status for this action button. 00066 */ 00067 void set_is_cancel(bool cancel = TRUE); 00068 00069 /* 00070 Parameters : void 00071 Returns : bool - The Cancel action button status. 00072 Description : Get the Cancel status for this action button. 00073 */ 00074 bool get_is_cancel() const; 00075 00076 /* 00077 Parameters : local - The Local action button status. 00078 Returns : void 00079 Description : Set the Local status for this action button. 00080 */ 00081 void set_is_local(bool local = TRUE); 00082 00083 /* 00084 Parameters : void 00085 Returns : bool - The Local action button status. 00086 Description : Get the Local status for this action button. 00087 */ 00088 bool get_is_local() const; 00089 00090 /* 00091 Parameters : menu - The menu semantics status. 00092 Returns : void 00093 Description : Set the menu sematics status for this action button. 00094 */ 00095 void set_is_menu(bool menu = TRUE); 00096 00097 /* 00098 Parameters : void 00099 Returns : bool - The menu semantics status. 00100 Description : Get the menu semantics status for this action button. 00101 */ 00102 bool get_is_menu() const; 00103 }; 00104 00105 /* 00106 Parameters : def - The Default action button status. 00107 Returns : void 00108 Description : Set the Default status for this action button. 00109 */ 00110 inline void actionbutton_b::set_is_default(bool def) 00111 { 00112 gadget_flags flags = _get_flags(); 00113 _set_flags(def 00114 ? flags | actionbutton_IS_DEFAULT 00115 : flags & ~actionbutton_IS_DEFAULT); 00116 } 00117 00118 /* 00119 Parameters : void 00120 Returns : bool - The Default action button status. 00121 Description : Get the Default status for this action button. 00122 */ 00123 inline bool actionbutton_b::get_is_default() const 00124 { 00125 return BOOL(_get_flags() & actionbutton_IS_DEFAULT); 00126 } 00127 00128 /* 00129 Parameters : cancel - The Cancel action button status. 00130 Returns : void 00131 Description : Set the Cancel status for this action button. 00132 */ 00133 inline void actionbutton_b::set_is_cancel(bool cancel) 00134 { 00135 gadget_flags flags = _get_flags(); 00136 _set_flags(cancel 00137 ? flags | actionbutton_IS_CANCEL 00138 : flags & ~actionbutton_IS_CANCEL); 00139 } 00140 00141 /* 00142 Parameters : void 00143 Returns : bool - The Cancel action button status. 00144 Description : Get the Cancel status for this action button. 00145 */ 00146 inline bool actionbutton_b::get_is_cancel() const 00147 { 00148 return BOOL(_get_flags() & actionbutton_IS_CANCEL); 00149 } 00150 00151 /* 00152 Parameters : local - The Local action button status. 00153 Returns : void 00154 Description : Set the Local status for this action button. 00155 */ 00156 inline void actionbutton_b::set_is_local(bool local) 00157 { 00158 gadget_flags flags = _get_flags(); 00159 _set_flags(local 00160 ? flags | actionbutton_IS_LOCAL 00161 : flags & ~actionbutton_IS_LOCAL); 00162 } 00163 00164 /* 00165 Parameters : void 00166 Returns : bool - The Local action button status. 00167 Description : Get the Local status for this action button. 00168 */ 00169 inline bool actionbutton_b::get_is_local() const 00170 { 00171 return BOOL(_get_flags() & actionbutton_IS_LOCAL); 00172 } 00173 00174 /* 00175 Parameters : menu - The menu semantics status. 00176 Returns : void 00177 Description : Set the menu sematics status for this action button. 00178 */ 00179 inline void actionbutton_b::set_is_menu(bool menu) 00180 { 00181 gadget_flags flags = _get_flags(); 00182 _set_flags(menu 00183 ? flags | actionbutton_IS_MENU 00184 : flags & ~actionbutton_IS_MENU); 00185 } 00186 00187 /* 00188 Parameters : void 00189 Returns : bool - The menu semantics status. 00190 Description : Get the menu semantics status for this action button. 00191 */ 00192 inline bool actionbutton_b::get_is_menu() const 00193 { 00194 return BOOL(_get_flags() & actionbutton_IS_MENU); 00195 } 00196 00197 #endif
1.3.3