00001 /* 00002 File : labelledbox_b.h 00003 Date : 19-Sep-02 00004 Description : Base class to represent a labelled box 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 labelledbox_b_h 00025 #define labelledbox_b_h 00026 00027 // Include oslib header files 00028 #include "oslib/labelledbox.h" 00029 00030 // Include alexlib header files 00031 #ifndef gadget_b_h 00032 #include "gadget_b.h" 00033 #endif 00034 00035 // A base class to represent a label gadget 00036 class labelledbox_b : virtual public gadget_b 00037 { 00038 public: 00039 00040 /* 00041 Parameters : sprite - Is the label a sprite. 00042 Returns : void 00043 Description : Set whether the labelled box has a sprite label. 00044 */ 00045 void set_has_sprite(bool sprite = TRUE); 00046 00047 /* 00048 Parameters : void 00049 Returns : bool - Is the label a sprite. 00050 Description : Get whether the labelled box has a sprite label. 00051 */ 00052 bool get_has_sprite() const; 00053 00054 /* 00055 Parameters : filled - Does the label have a filled background. 00056 Returns : void 00057 Description : Set whether the label has a filled background. 00058 */ 00059 void set_is_filled(bool filled = TRUE); 00060 00061 /* 00062 Parameters : void 00063 Returns : bool - Does the label have a filled background. 00064 Description : Get whether the label has a filled background. 00065 */ 00066 bool get_is_filled() const; 00067 }; 00068 00069 /* 00070 Parameters : sprite - Is the label a sprite. 00071 Returns : void 00072 Description : Set whether the labelled box has a sprite label. 00073 */ 00074 inline void labelledbox_b::set_has_sprite(bool sprite) 00075 { 00076 gadget_flags flags = _get_flags(); 00077 _set_flags(sprite 00078 ? flags | labelledbox_SPRITE 00079 : flags & ~labelledbox_SPRITE); 00080 } 00081 00082 /* 00083 Parameters : void 00084 Returns : bool - Is the label a sprite. 00085 Description : Get whether the labelled box has a sprite label. 00086 */ 00087 inline bool labelledbox_b::get_has_sprite() const 00088 { 00089 return BOOL(_get_flags() & labelledbox_SPRITE); 00090 } 00091 00092 /* 00093 Parameters : filled - Does the label have a filled background. 00094 Returns : void 00095 Description : Set whether the label has a filled background. 00096 */ 00097 inline void labelledbox_b::set_is_filled(bool filled) 00098 { 00099 gadget_flags flags = _get_flags(); 00100 _set_flags(filled 00101 ? flags | labelledbox_SPRITE_IS_FILLED 00102 : flags & ~labelledbox_SPRITE_IS_FILLED); 00103 } 00104 00105 /* 00106 Parameters : void 00107 Returns : bool - Does the label have a filled background. 00108 Description : Get whether the label has a filled background. 00109 */ 00110 inline bool labelledbox_b::get_is_filled() const 00111 { 00112 return BOOL(_get_flags() & labelledbox_SPRITE_IS_FILLED); 00113 } 00114 00115 #endif
1.3.3