00001 /* 00002 File : gadget_w_font.h 00003 Date : 19-Sep-02 00004 Description : Class to represent a toolbox gadget that has a selectable 00005 font. 00006 00007 Copyright © 1995-2002 Alexander Thoukydides 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 00012 of the License, or (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00022 */ 00023 00024 // Only include header file once 00025 #ifndef gadget_w_font_h 00026 #define gadget_w_font_h 00027 00028 // Include cpplib header files 00029 #include "string.h" 00030 00031 // A class to represent a gadget with selectable font 00032 class gadget_w_font 00033 { 00034 public: 00035 00036 /* 00037 Parameters : font - The name of the font to use, or NULL to use the 00038 system font. 00039 xsize - The width in 16ths of a point. 00040 ysize - The height in 16ths of a point. 00041 Returns : void 00042 Description : Set the font for this gadget. 00043 */ 00044 void set_font(const char *font = NULL, int xsize = 0, int ysize = 0); 00045 00046 /* 00047 Parameters : font - The name of the font to use. 00048 xsize - The width in 16ths of a point. 00049 ysize - The height in 16ths of a point. 00050 Returns : void 00051 Description : Set the font for this gadget. 00052 */ 00053 void set_font(const string &font, int xsize, int ysize); 00054 00055 protected: 00056 00057 /* 00058 Parameters : font - The name of the font to use, or NULL to use the 00059 system font. 00060 xsize - The width in 16ths of a point. 00061 ysize - The height in 16ths of a point. 00062 Returns : void 00063 Description : Gadget specific function to set the font. 00064 */ 00065 virtual void _set_font(const char *font, int xsize, int ysize) = 0; 00066 }; 00067 00068 /* 00069 Parameters : font - The name of the font to use. 00070 xsize - The width in 16ths of a point. 00071 ysize - The height in 16ths of a point. 00072 Returns : void 00073 Description : Set the font for this gadget. 00074 */ 00075 inline void gadget_w_font::set_font(const char *font, int xsize, int ysize) 00076 { 00077 _set_font(font, xsize, ysize); 00078 } 00079 00080 /* 00081 Parameters : font - The name of the font to use. 00082 xsize - The width in 16ths of a point. 00083 ysize - The height in 16ths of a point. 00084 Returns : void 00085 Description : Set the font for this gadget. 00086 */ 00087 inline void gadget_w_font::set_font(const string &font, 00088 int xsize, int ysize) 00089 { 00090 _set_font(font.c_str(), xsize, ysize); 00091 } 00092 00093 #endif
1.3.3