1 /* 2 * $Id: label.h,v 1.20 2012/03/21 21:15:30 tom Exp $ 3 */ 4 5 #ifndef CDKINCLUDES 6 #ifndef CDKLABEL_H 7 #define CDKLABEL_H 1 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #ifndef CDK_H 14 #define CDKINCLUDES 15 #include <cdk.h> 16 #undef CDKINCLUDES 17 #include <binding.h> 18 #include <cdkscreen.h> 19 #include <cdk_objs.h> 20 #endif 21 22 /* 23 * Changes 2000-2003,2012 copyright Thomas E. Dickey 24 * 25 * Copyright 1999, Mike Glover 26 * All rights reserved. 27 * 28 * Redistribution and use in source and binary forms, with or without 29 * modification, are permitted provided that the following conditions 30 * are met: 31 * 1. Redistributions of source code must retain the above copyright 32 * notice, this list of conditions and the following disclaimer. 33 * 2. Redistributions in binary form must reproduce the above copyright 34 * notice, this list of conditions and the following disclaimer in the 35 * documentation and/or other materials provided with the distribution. 36 * 3. All advertising materials mentioning features or use of this software 37 * must display the following acknowledgment: 38 * This product includes software developed by Mike Glover 39 * and contributors. 40 * 4. Neither the name of Mike Glover, nor the names of contributors 41 * may be used to endorse or promote products derived from this software 42 * without specific prior written permission. 43 * 44 * THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND 45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 47 * ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE 48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 * SUCH DAMAGE. 55 */ 56 57 /* 58 * Declare any definitions you need to make. 59 */ 60 #define MAX_LABEL_ROWS 300 /* unused by widgets */ 61 62 /* 63 * Declare the CDK label structure. 64 */ 65 struct SLabel { 66 CDKOBJS obj; 67 WINDOW * parent; 68 WINDOW * win; 69 WINDOW * shadowWin; 70 chtype ** info; 71 int * infoLen; 72 int * infoPos; 73 int boxWidth; 74 int boxHeight; 75 int xpos; 76 int ypos; 77 int rows; 78 boolean shadow; 79 }; 80 typedef struct SLabel CDKLABEL; 81 82 /* 83 * This creates a new CDK label widget. 84 */ 85 CDKLABEL *newCDKLabel ( 86 CDKSCREEN * /* screen */, 87 int /* xPos */, 88 int /* yPos */, 89 CDK_CSTRING2 /* mesg */, 90 int /* rows */, 91 boolean /* Box */, 92 boolean /* shadow */); 93 94 /* 95 * This was added to make the builder simpler. All this will 96 * do is call drawCDKLabel. 97 */ 98 void activateCDKLabel ( 99 CDKLABEL * /* label */, 100 chtype * /* actions */); 101 102 /* 103 * This sets multiple attributes of the widget. 104 */ 105 void setCDKLabel ( 106 CDKLABEL * /* label */, 107 CDK_CSTRING2 /* message */, 108 int /* lines */, 109 boolean /* Box */); 110 111 /* 112 * This sets the contents of the label. 113 */ 114 void setCDKLabelMessage ( 115 CDKLABEL * /* label */, 116 CDK_CSTRING2 /* mesg */, 117 int /* lines */); 118 chtype **getCDKLabelMessage ( 119 CDKLABEL * /* label */, 120 int * /* size */); 121 122 /* 123 * This sets the box attribute of the widget. 124 */ 125 void setCDKLabelBox ( 126 CDKLABEL * /* label */, 127 boolean /* Box */); 128 boolean getCDKLabelBox ( 129 CDKLABEL * /* label */); 130 131 /* 132 * This draws the label. 133 */ 134 #define drawCDKLabel(obj,Box) drawCDKObject(obj,Box) 135 136 /* 137 * These set the drawing characters of the widget. 138 */ 139 #define setCDKLabelULChar(w,c) setULCharOf(w,c) 140 #define setCDKLabelURChar(w,c) setURCharOf(w,c) 141 #define setCDKLabelLLChar(w,c) setLLCharOf(w,c) 142 #define setCDKLabelLRChar(w,c) setLRCharOf(w,c) 143 #define setCDKLabelVerticalChar(w,c) setVTCharOf(w,c) 144 #define setCDKLabelHorizontalChar(w,c) setHZCharOf(w,c) 145 #define setCDKLabelBoxAttribute(w,c) setBXAttrOf(w,c) 146 147 /* 148 * This sets the background color of the widget. 149 */ 150 #define setCDKLabelBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) 151 152 /* 153 * This sets the background attribute of the widget. 154 */ 155 #define setCDKLabelBackgroundAttrib(w,c) setBKAttrOf(w,c) 156 157 /* 158 * This erases the label. 159 */ 160 #define eraseCDKLabel(obj) eraseCDKObject(obj) 161 162 /* 163 * This destroys the label and the memory used by it. 164 */ 165 #define destroyCDKLabel(obj) destroyCDKObject(obj) 166 167 /* 168 * This draws the label then waits for the user to press 169 * the key defined by the 'key' parameter. 170 */ 171 char waitCDKLabel ( 172 CDKLABEL * /* label */, 173 char /* key */); 174 175 /* 176 * This moves the label. 177 */ 178 #define moveCDKLabel(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) 179 180 /* 181 * This allows the user to interactively position the label. 182 */ 183 #define positionCDKLabel(widget) positionCDKObject(ObjOf(widget),widget->win) 184 185 #ifdef __cplusplus 186 } 187 #endif 188 189 #endif /* CDKLABEL_H */ 190 #endif /* CDKINCLUDES */ 191