Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

draggable_c.h

Go to the documentation of this file.
00001 /*
00002     File        : draggable_c.h
00003     Date        : 19-Sep-02
00004     Description : Class to represent a draggable 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 draggable_c_h
00025 #define draggable_c_h
00026 
00027 // Include alexlib header files
00028 #ifndef draggable_b_h
00029 #include "draggable_b.h"
00030 #endif
00031 #ifndef gadget_c_h
00032 #include "gadget_c.h"
00033 #endif
00034 #ifndef gadget_w_boolean_h
00035 #include "gadget_w_boolean.h"
00036 #endif
00037 
00038 // A class to represent a button gadget
00039 class draggable_c : public virtual gadget_b,
00040                     public gadget_c,
00041                     public draggable_b,
00042                     public gadget_w_boolean
00043 {
00044 public:
00045 
00046     /*
00047         Parameters  : component - The component ID of this draggable gadget.
00048                       object    - The object ID of this draggable gadget's
00049                                   parent window.
00050         Returns     : -
00051         Description : Constructor function. This does not create a draggable
00052                       gadget; it merely creates an object to represent the
00053                       draggable gadget.
00054     */
00055     draggable_c(toolbox_c component = toolbox_NULL_COMPONENT,
00056                 toolbox_o object = toolbox_NULL_OBJECT);
00057 
00058     /*
00059         Parameters  : value         - The value to set.
00060         Returns     : draggable_c   - This object.
00061         Description : Set the value of this gadget. To reduce flicker the value
00062                       is not updated unless it has changed.
00063     */
00064     draggable_c &operator=(bool value);
00065 
00066 protected:
00067 
00068     /*
00069         Parameters  : value - The value to set.
00070         Returns     : void
00071         Description : Gadget specific function to set the value.
00072     */
00073     virtual void _set_value(bool value);
00074 
00075     /*
00076         Parameters  : void
00077         Returns     : bool  - The value
00078         Description : Gadget specific function to get the value.
00079     */
00080     virtual bool _get_value() const;
00081 
00082     /*
00083         Parameters  : text  - The text string to set.
00084         Returns     : void
00085         Description : Gadget specific function to set the text.
00086     */
00087     virtual void _set_text(const char *text);
00088 
00089     /*
00090         Parameters  : text      - Pointer to buffer to hold the text, or NULL
00091                                   to read the size of buffer required.
00092                       size      - The size of the buffer.
00093         Returns     : size_t    - Number of bytes written to the buffer, or
00094                                   the buffer size required if NULL passed.
00095         Description : Gadget specific function to get the text or the buffer
00096                       size required.
00097     */
00098     virtual size_t _get_text(char *text, size_t size) const;
00099 
00100     /*
00101         Parameters  : sprite    - The sprite name.
00102         Returns     : void
00103         Description : Representation specific function to set the sprite name.
00104     */
00105     virtual void _set_sprite(const char *sprite);
00106 
00107     /*
00108         Parameters  : sprite    - Pointer to buffer to hold the sprite name,
00109                                   or NULL to read the size of buffer required.
00110                       size      - The size of the buffer.
00111         Returns     : size_t    - Number of bytes written to the buffer, or
00112                                   the buffer size required if NULL passed.
00113         Description : Representation specific function to get the sprite name
00114                       or the buffer size required.
00115     */
00116     virtual size_t _get_sprite(char *sprite, size_t size) const;
00117 };
00118 
00119 /*
00120     Parameters  : component - The component ID of this draggable gadget.
00121                   object    - The object ID of this draggable gadget's
00122                               parent window.
00123     Returns     : -
00124     Description : Constructor function. This does not create a draggable
00125                   gadget; it merely creates an object to represent the
00126                   draggable gadget.
00127 */
00128 inline draggable_c::draggable_c(toolbox_c component, toolbox_o object)
00129 : gadget_c(component, object) {}
00130 
00131 #endif

Generated on Sun Jan 26 10:18:43 2025 for NBLib by doxygen 1.3.3