1 /* 2 * $Id: alphalist.h,v 1.25 2014/01/19 01:58:40 tom Exp $ 3 */ 4 5 #ifndef CDKINCLUDES 6 #ifndef CDKALPHALIST_H 7 #define CDKALPHALIST_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 1999-2012,2014 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 #include <entry.h> 58 #include <scroll.h> 59 60 /* 61 * Define the CDK alphalist widget structure. 62 */ 63 struct SAlphalist { 64 CDKOBJS obj; 65 WINDOW * parent; 66 WINDOW * win; 67 WINDOW * shadowWin; 68 CDKENTRY * entryField; 69 CDKSCROLL * scrollField; 70 char ** list; 71 int listSize; 72 int xpos; 73 int ypos; 74 int height; 75 int width; 76 int boxHeight; 77 int boxWidth; 78 chtype highlight; 79 chtype fillerChar; 80 boolean shadow; 81 EExitType exitType; 82 }; 83 typedef struct SAlphalist CDKALPHALIST; 84 85 /* 86 * This creates a pointer to a new CDK alphalist widget. 87 */ 88 CDKALPHALIST *newCDKAlphalist ( 89 CDKSCREEN * /* cdkscreen */, 90 int /* xpos */, 91 int /* ypos */, 92 int /* height */, 93 int /* width */, 94 const char * /* title */, 95 const char * /* label */, 96 CDK_CSTRING * /* list */, 97 int /* listSize */, 98 chtype /* fillerChar */, 99 chtype /* highlight */, 100 boolean /* Box */, 101 boolean /* shadow */); 102 103 /* 104 * This allows the user to interact with the widget. 105 */ 106 char *activateCDKAlphalist ( 107 CDKALPHALIST * /* alphalist */, 108 chtype * /* actions */); 109 110 /* 111 * This injects a single character into the widget. 112 */ 113 #define injectCDKAlphalist(obj,input) injectCDKObject(obj,input,String) 114 115 /* 116 * This sets multiple attributes of the alphalist widget. 117 */ 118 void setCDKAlphalist ( 119 CDKALPHALIST * /* alphalist */, 120 CDK_CSTRING * /* list */, 121 int /* listSize */, 122 chtype /* fillerChar */, 123 chtype /* highlight */, 124 boolean /* Box */); 125 126 /* 127 * This sets the contents of the alpha list. 128 */ 129 void setCDKAlphalistContents ( 130 CDKALPHALIST * /* alphalist */, 131 CDK_CSTRING * /* list */, 132 int /* listSize */); 133 134 char **getCDKAlphalistContents ( 135 CDKALPHALIST * /* alphalist */, 136 int * /* size */); 137 138 /* 139 * Get/set the current position in the scroll-widget. 140 */ 141 int getCDKAlphalistCurrentItem( 142 CDKALPHALIST * /* widget */); 143 144 void setCDKAlphalistCurrentItem( 145 CDKALPHALIST * /* widget */, 146 int /* item */); 147 148 /* 149 * This sets the filler character of the entry field of the alphalist. 150 */ 151 void setCDKAlphalistFillerChar ( 152 CDKALPHALIST * /* alphalist */, 153 chtype /* fillerCharacter */); 154 155 chtype getCDKAlphalistFillerChar ( 156 CDKALPHALIST * /* alphalist */); 157 158 /* 159 * This sets the highlight bar attributes. 160 */ 161 void setCDKAlphalistHighlight ( 162 CDKALPHALIST * /* alphalist */, 163 chtype /* highlight */); 164 165 chtype getCDKAlphalistHighlight ( 166 CDKALPHALIST * /* alphalist */); 167 168 /* 169 * This sets the box attribute of the widget. 170 */ 171 void setCDKAlphalistBox ( 172 CDKALPHALIST * /* alphalist */, 173 boolean /* Box */); 174 175 boolean getCDKAlphalistBox ( 176 CDKALPHALIST * /* alphalist */); 177 178 /* 179 * These functions set the drawing characters of the widget. 180 */ 181 #define setCDKAlphalistULChar(w,c) setULCharOf(w,c) 182 #define setCDKAlphalistURChar(w,c) setURCharOf(w,c) 183 #define setCDKAlphalistLLChar(w,c) setLLCharOf(w,c) 184 #define setCDKAlphalistLRChar(w,c) setLRCharOf(w,c) 185 #define setCDKAlphalistVerticalChar(w,c) setVTCharOf(w,c) 186 #define setCDKAlphalistHorizontalChar(w,c) setHZCharOf(w,c) 187 #define setCDKAlphalistBoxAttribute(w,c) setBXAttrOf(w,c) 188 189 /* 190 * This sets the background color of the widget. 191 */ 192 #define setCDKAlphalistBackgroundColor(w,c) setCDKObjectBackgroundColor(ObjOf(w),c) 193 194 /* 195 * This sets the background attribute of the widget. 196 */ 197 #define setCDKAlphalistBackgroundAttrib(w,c) setBKAttrOf(w,c) 198 199 /* 200 * This draws the widget on the screen. 201 */ 202 #define drawCDKAlphalist(obj,box) drawCDKObject(obj,box) 203 204 /* 205 * This removes the widget from the screen. 206 */ 207 #define eraseCDKAlphalist(obj) eraseCDKObject(obj) 208 209 /* 210 * This moves the widget to the location specified. 211 */ 212 #define moveCDKAlphalist(obj,xpos,ypos,relative,refresh) moveCDKObject(obj,xpos,ypos,relative,refresh) 213 214 /* 215 * This allows the user to interactively position the widget. 216 */ 217 #define positionCDKAlphalist(widget) positionCDKObject(ObjOf(widget),widget->win) 218 219 /* 220 * This destroys the widget and all the memory associated with it. 221 */ 222 #define destroyCDKAlphalist(obj) destroyCDKObject(obj) 223 224 /* 225 * These functions set the pre and post process functions for the widget. 226 */ 227 void setCDKAlphalistPreProcess ( 228 CDKALPHALIST * /* alphalist */, 229 PROCESSFN /* callback */, 230 void * /* data */); 231 232 void setCDKAlphalistPostProcess ( 233 CDKALPHALIST * /* alphalist */, 234 PROCESSFN /* callback */, 235 void * /* data */); 236 237 #ifdef __cplusplus 238 } 239 #endif 240 241 #endif /* CDKALPHALIST_H */ 242 #endif /* CDKINCLUDES */ 243