1 /* vibprocs.h 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information (NCBI) 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government do not place any restriction on its use or reproduction. 13 * We would, however, appreciate having the NCBI and the author cited in 14 * any work or product based on this material 15 * 16 * Although all reasonable efforts have been taken to ensure the accuracy 17 * and reliability of the software and data, the NLM and the U.S. 18 * Government do not and cannot warrant the performance or results that 19 * may be obtained by using this software or data. The NLM and the U.S. 20 * Government disclaim all warranties, express or implied, including 21 * warranties of performance, merchantability or fitness for any particular 22 * purpose. 23 * 24 * =========================================================================== 25 * 26 * File Name: vibprocs.h 27 * 28 * Author: Jonathan Kans 29 * 30 * Version Creation Date: 7/1/91 31 * 32 * $Revision: 6.39 $ 33 * 34 * File Description: 35 * Vibrant procedure definitions 36 * 37 * Modifications: 38 * -------------------------------------------------------------------------- 39 * 40 * ========================================================================== 41 */ 42 43 #ifndef _VIBPROCS_ 44 #define _VIBPROCS_ 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /*** GLOBAL VARIABLES ***/ 51 52 /* 53 * The fileDone flag indicates success or failure of the last 54 * file operation, and can be used to test for end-of-file on 55 * input. The termCH character contains the character that 56 * terminated the most recently read string, field, or line. 57 * That character is not included in the string. 58 */ 59 60 extern Nlm_Boolean Nlm_fileDone; 61 extern Nlm_Int2 Nlm_fileError; 62 extern Nlm_Char Nlm_termCH; 63 64 /* 65 * The currentKey variable can be used by callback routines to 66 * determine what key was most recently pressed by the user. 67 */ 68 69 extern Nlm_Char Nlm_currentKey; 70 71 /* 72 * The cmmdKey, ctrlKey, optKey and shftKey flags reflect the 73 * status of the command key, the control key, the option key, 74 * and the shift key of the keyboard, respectively. Macintosh, 75 * IBM PC, and Unix machines may only have a subset of these 76 * modifier keys on their keyboards. The dblClick flag is set 77 * if the user double clicked in a list selection box. 78 */ 79 80 extern Nlm_Boolean Nlm_cmmdKey; 81 extern Nlm_Boolean Nlm_ctrlKey; 82 extern Nlm_Boolean Nlm_optKey; 83 extern Nlm_Boolean Nlm_shftKey; 84 extern Nlm_Boolean Nlm_dblClick; 85 86 /* 87 * The screenRect contains the size in pixels of the computer screen. 88 */ 89 90 extern Nlm_RecT Nlm_screenRect; 91 92 /* 93 * Miscellaneous constants define the width and height of scroll bars. 94 */ 95 96 extern Nlm_Int2 Nlm_hScrollBarHeight; 97 extern Nlm_Int2 Nlm_vScrollBarWidth; 98 99 /* 100 * Miscellaneous constants define the height of certain control objects. 101 */ 102 103 extern Nlm_Int2 Nlm_popupMenuHeight; 104 extern Nlm_Int2 Nlm_dialogTextHeight; 105 106 107 /*** PROCEDURES THAT CREATE INTERFACE OBJECTS ***/ 108 109 /*** WINDOW OBJECTS ***/ 110 111 /* 112 * When positive, the left and top window parameters specify the pixel 113 * location of the upper left hand corner of the window on the screen. 114 * When negative, they specify the a relative percentage position, with 115 * -50, -33 meaning centered horizontally and placed vertically one third 116 * of the way down the screen. When positive, the width and height 117 * parameters indicate the pixel size of the window. When negative, they 118 * indicate that the window, when first made visible, will size itself to 119 * fit around the objects it contains, with the absolute value of the 120 * width being the number of pixels to use as a border around the internal 121 * objects and the absolute value of the height being the spacing between 122 * objects. 123 */ 124 125 /* 126 * Document, Fixed, and Round windows may be dragged around the screen by 127 * the user. Document windows may also be resized by the user. When a 128 * Modal window is the front window, the user is prevented from bringing 129 * other windows to the front or from making menu choices. This should 130 * be used only when extra information is essential in order to proceed, 131 * or to alert the user to critical error conditions. Modal windows should 132 * be created when needed and destroyed immediately upon release. If a 133 * modal window is hidden, it may inhibit any user input. Floating windows 134 * float above other windows, and can be useful for selecting tools (such 135 * as in a MacPaint drawing palette) without needing to change the active 136 * window each time. The close procedure is called when the user clicks in 137 * the close box of a window. The callback procedure will usually hide or 138 * remove the window, or may display a modal window asking the user to 139 * confirm the close. The activate and deactivate procedures are executed 140 * when a window is activated or deactivated, and the resize procedure is 141 * called when the user changes the size of a window. 142 */ 143 144 #ifdef WIN_MOTIF 145 /* Useful when creating a top-level (shell) window containing 146 * 3D-viewer -- as the latter overwrites all colorcells from 32 to 255 147 * This restriction is valid while creating the next(the only!) 148 * top-level window, then expires */ 149 void Nlm_RestrictMotifColorsTo PROTO ( (Nlm_Uchar n_colorcells) ); 150 #else 151 #define Nlm_RestrictMotifColorsTo(dummy) {;} 152 #endif 153 154 Nlm_WindoW Nlm_DocumentWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_CharPtr title, Nlm_WndActnProc close, Nlm_WndActnProc resize)); 155 Nlm_WindoW Nlm_FixedWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_CharPtr title, Nlm_WndActnProc close)); 156 Nlm_WindoW Nlm_FrozenWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_CharPtr title, Nlm_WndActnProc close)); 157 Nlm_WindoW Nlm_RoundWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_CharPtr title, Nlm_WndActnProc close)); 158 Nlm_WindoW Nlm_AlertWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_WndActnProc close)); 159 Nlm_WindoW Nlm_ModalWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_WndActnProc close)); 160 Nlm_WindoW Nlm_FloatingWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_WndActnProc close)); 161 Nlm_WindoW Nlm_ShadowWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_WndActnProc close)); 162 Nlm_WindoW Nlm_PlainWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_WndActnProc close)); 163 164 Nlm_WindoW Nlm_ResizableModalWindow(Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_CharPtr title, Nlm_WndActnProc close, Nlm_WndActnProc resize); 165 166 /* esl++ */ 167 Nlm_WindoW Nlm_MovableModalWindow PROTO((Nlm_Int2 left, Nlm_Int2 top, Nlm_Int2 width, Nlm_Int2 height, Nlm_CharPtr title, Nlm_WndActnProc close)); 168 void Nlm_SetModalWindowOwner PROTO((Nlm_WindoW w, Nlm_WindoW owner)); 169 Nlm_Boolean Nlm_IsWindowModal PROTO((Nlm_WindoW w)); 170 171 void Nlm_SetClose PROTO((Nlm_WindoW w, Nlm_WndActnProc cls)); 172 void Nlm_SetActivate PROTO((Nlm_WindoW w, Nlm_WndActnProc act)); 173 void Nlm_SetDeactivate PROTO((Nlm_WindoW w, Nlm_WndActnProc deact)); 174 void Nlm_SetResize PROTO((Nlm_WindoW w, Nlm_WndActnProc resiz)); 175 void Nlm_SetColorMap PROTO((Nlm_WindoW w, Nlm_Uint2 totalColors, 176 Nlm_Uint1Ptr red, Nlm_Uint1Ptr green, 177 Nlm_Uint1Ptr blue)); 178 void Nlm_SetColorCell PROTO((Nlm_GraphiC w, Nlm_Uint1 pixel, 179 Nlm_Uint1 red, Nlm_Uint1 green, 180 Nlm_Uint1 blue)); 181 182 void Nlm_SetWindowExtra PROTO((Nlm_WindoW w, Nlm_VoidPtr data, Nlm_WndFreeProc cleanup)); 183 Nlm_VoidPtr Nlm_GetWindowExtra PROTO((Nlm_WindoW w)); 184 185 void Nlm_SetWindowConfigureCallback PROTO((Nlm_WindoW w)); 186 187 /* Dual screen functions control centering where the window left parameter is negative */ 188 189 Nlm_Boolean Nlm_HasDualScreen (void); 190 Nlm_Boolean Nlm_IsRemoteDesktop (void); 191 192 void Nlm_UseFullScreen (void); 193 void Nlm_UseLeftScreen (void); 194 void Nlm_UseRightScreen (void); 195 void Nlm_UsePrimaryMonitor (void); 196 197 198 /*** GROUPING OBJECT ***/ 199 200 /* 201 * Groups are used for fine control of automatic positioning of objects 202 * within a window. When containing radio buttons, the integer value of 203 * the group corresponds to the current button choice. See SetValue and 204 * GetValue under Object Title and State Manipulations Procedures. When 205 * both the width and height of a group are 0, objects within the group 206 * are overlapped at the same location. The default group margins are 207 * 3 horizontal and 2 vertical pixels. This can be changed with the 208 * SetGroupMargins procedure. 209 */ 210 211 Nlm_GrouP Nlm_NormalGroup PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_CharPtr title, Nlm_FonT font, Nlm_GrpActnProc actn)); 212 Nlm_GrouP Nlm_HiddenGroup PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_GrpActnProc actn)); 213 void Nlm_SetGroupMargins PROTO((Nlm_GrouP g, Nlm_Int2 xMargin, Nlm_Int2 yMargin)); 214 void Nlm_SetGroupSpacing PROTO((Nlm_GrouP g, Nlm_Int2 xSpacing, Nlm_Int2 ySpacing)); 215 216 /* 217 * In the following object creation procedures, whenever the parent 218 * parameter specifies GrouP, a WindoW may also be used, because 219 * both objects are handles to the same dummy structure. 220 */ 221 222 /*** CONTROL OBJECTS ***/ 223 224 /*** Button Objects ***/ 225 226 /* 227 * Push buttons and Default buttons allow the user to trigger specific 228 * callback functions. Check boxes allow the user to specify boolean 229 * yes/no flags. The parent group containing radio buttons has an 230 * integer value that corresponds to one of several mutually exclusive 231 * choices that the user can make. Radio buttons return handles only to 232 * allow them to be individually disabled or hidden. They should be used 233 * in the same manner as list items and choice items. 234 */ 235 236 Nlm_ButtoN Nlm_PushButton PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_BtnActnProc actn)); 237 Nlm_ButtoN Nlm_DefaultButton PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_BtnActnProc actn)); 238 Nlm_ButtoN Nlm_CheckBox PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_BtnActnProc actn)); 239 Nlm_ButtoN Nlm_RadioButton PROTO((Nlm_GrouP prnt, Nlm_CharPtr title)); 240 241 /* These buttons take a font parameter */ 242 Nlm_ButtoN Nlm_PushButtonEx PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_BtnActnProc actn, Nlm_FonT font)); 243 Nlm_ButtoN Nlm_DefaultButtonEx PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_BtnActnProc actn, Nlm_FonT font)); 244 Nlm_ButtoN Nlm_CheckBoxEx PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_BtnActnProc actn, Nlm_FonT font)); 245 Nlm_ButtoN Nlm_RadioButtonEx PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_FonT font)); 246 247 /*** Scrolling Choice List Objects ***/ 248 249 /* 250 * Single choice and Multiple choice lists functionally correspond to groups of 251 * radio buttons or check boxes. Because they have the appearance of scrolling 252 * choice lists instead of buttons, additional items do not change the size of 253 * the list object. To prevent automatic refreshing of the screen after every 254 * append use the Disable function. Calling Enable will update the list. 255 */ 256 257 Nlm_LisT Nlm_SingleList PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_LstActnProc actn)); 258 Nlm_LisT Nlm_MultiList PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_LstActnProc actn)); 259 Nlm_LisT Nlm_ExtendedList PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_LstActnProc actn)); 260 void Nlm_ListItem PROTO((Nlm_LisT l, Nlm_CharPtr title)); 261 void Nlm_GetListItem PROTO((Nlm_LisT l, Nlm_Int2 item, 262 Nlm_CharPtr title, size_t maxsize)); 263 264 /*** Menu Objects ***/ 265 266 /* 267 * A Pulldown or Apple menu can appear on the desktop (NULL window) or 268 * in a menu bar within a given window. Popup menus can appear anywhere 269 * in a window. Submenus can appear in any of the above menus, or in 270 * other submenus. Command items act exactly like push buttons, in that 271 * they are used to trigger specific callback routines. Status items 272 * correspond to boolean check boxes. Choice groups are mutually 273 * exclusive groups of choices that function exactly like radio groups or 274 * single choice lists. The active choice has a check mark in front of 275 * it. A Popup list is a popup menu with a choice group that displays the 276 * current value of the choice group on the window. The DeskAccGroup 277 * allows the user to display a Macintosh desk accessory menu (usually in 278 * the Apple menu). A Font group creates a menu choice group composed of 279 * the available fonts in the System file. The Separator item places a 280 * dotted line in between groups of menu items. 281 */ 282 283 Nlm_MenU Nlm_PulldownMenu PROTO((Nlm_WindoW w, Nlm_CharPtr title)); 284 Nlm_MenU Nlm_AppleMenu PROTO((Nlm_WindoW w)); 285 Nlm_MenU Nlm_PopupMenu PROTO((Nlm_GrouP prnt, Nlm_CharPtr title)); 286 Nlm_MenU Nlm_SubMenu PROTO((Nlm_MenU m, Nlm_CharPtr title)); 287 Nlm_IteM Nlm_CommandItem PROTO((Nlm_MenU m, Nlm_CharPtr title, Nlm_ItmActnProc actn)); 288 Nlm_IteM Nlm_StatusItem PROTO((Nlm_MenU m, Nlm_CharPtr title, Nlm_ItmActnProc actn)); 289 Nlm_ChoicE Nlm_ChoiceGroup PROTO((Nlm_MenU m, Nlm_ChsActnProc actn)); 290 Nlm_IteM Nlm_ChoiceItem PROTO((Nlm_ChoicE c, Nlm_CharPtr title)); 291 Nlm_PopuP Nlm_PopupList PROTO((Nlm_GrouP prnt, Nlm_Boolean macLike, Nlm_PupActnProc actn)); 292 Nlm_PopuP Nlm_PopupListEx PROTO((Nlm_GrouP prnt, Nlm_Boolean macLike, Nlm_PupActnProc actn, Nlm_FonT font)); 293 void Nlm_PopupItem PROTO((Nlm_PopuP p, Nlm_CharPtr title)); 294 void Nlm_PopupItems PROTO((Nlm_PopuP p, Nlm_CharPtr PNTR titles)); 295 void Nlm_DeskAccGroup PROTO((Nlm_MenU m)); 296 Nlm_ChoicE Nlm_FontGroup PROTO((Nlm_MenU m)); 297 void Nlm_SeparatorItem PROTO((Nlm_MenU m)); 298 Nlm_Boolean Nlm_HasAquaMenuLayout (void); 299 300 /*** Bar Object ***/ 301 302 /* 303 * This scroll bar is a normal object that can be used for input of integers. 304 * Width or height specify the number of standard character widths or standard 305 * character line heights to make the scroll bar. 306 * 307 * CorrectBarValue, CorrectBarMax and CorrectBarPage will change 308 * the scroll bar value/max/page without triggering the scroll bar's callback. 309 * 310 * SetBarValue and GetBarValue functions allows one to set Int4 value to 311 * the scrollbar -- unlike the generic SetValue and GetValue functions 312 * which operate with Int2 values only. 313 */ 314 315 Nlm_BaR Nlm_ScrollBar4 PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_BarScrlProc4 actn)); 316 Nlm_BaR Nlm_ScrollBar PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_BarScrlProc actn)); 317 318 void Nlm_SetBarValue PROTO((Nlm_BaR b, Nlm_Int4 val)); 319 void Nlm_CorrectBarValue PROTO((Nlm_BaR b, Nlm_Int4 val)); 320 Nlm_Int4 Nlm_GetBarValue PROTO((Nlm_BaR b)); 321 322 void Nlm_SetBarMax PROTO((Nlm_BaR b, Nlm_Int4 max)); 323 void Nlm_CorrectBarMax PROTO((Nlm_BaR b, Nlm_Int4 max)); 324 Nlm_Int4 Nlm_GetBarMax PROTO((Nlm_BaR b)); 325 326 void Nlm_CorrectBarPage PROTO((Nlm_BaR b, Nlm_Int4 pgUp, Nlm_Int4 pgDn)); 327 328 typedef enum 329 { 330 SCROLL_LINEUP = 0, 331 SCROLL_LINEDN, 332 SCROLL_PAGEUP, 333 SCROLL_PAGEDN 334 } Nlm_enumScrollEvent; 335 void Nlm_Scroll PROTO((Nlm_BaR b, Nlm_enumScrollEvent event)); 336 337 /*** Repeat Object ***/ 338 339 /* 340 * Repeat buttons are implemented as autonomous PaneLs. They will repeatedly 341 * trigger the callback in response to click and hold messages. 342 */ 343 344 Nlm_RepeaT Nlm_RepeatButton PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_RptClckProc actn)); 345 346 /*** Icon Object ***/ 347 348 /* 349 * Icon buttons are implemented as autonomous PaneLs. They are used for to display 350 * arbitrary bitmaps. The draw callback should get the value of the icon button to 351 * determine what to display. The click, drag, hold and release mouse callbacks (see 352 * SetPanelClick) may set the value of the icon button to change its appearance. 353 */ 354 355 Nlm_IcoN Nlm_IconButton PROTO((Nlm_GrouP prnt, Nlm_Int2 pixwidth, Nlm_Int2 pixheight, Nlm_IcnActnProc draw, Nlm_IcnChngProc inval, 356 Nlm_IcnClckProc click, Nlm_IcnClckProc drag, Nlm_IcnClckProc hold, Nlm_IcnClckProc release)); 357 358 /*** Switch Object ***/ 359 360 /* 361 * The switch object is used as a miniature scroll bar, with up and down arrows but no 362 * thumb or page areas. It can optionally display a (non-editable) text representation 363 * of the value (e.g., "5/15"). The value is manipulated with SetValue and GetValue. 364 * The arrows will allow the user to set values from 1 through max. SetSwitchParams will 365 * set both the max and the value at once, to avoid flickering by multiple redraws. 366 */ 367 368 Nlm_SwitcH Nlm_UpDownSwitch PROTO((Nlm_GrouP prnt, Nlm_Boolean text, Nlm_SwtChngProc actn)); 369 Nlm_SwitcH Nlm_LeftRightSwitch PROTO((Nlm_GrouP prnt, Nlm_Boolean text, Nlm_SwtChngProc actn)); 370 void Nlm_SetSwitchMax PROTO((Nlm_SwitcH s, Nlm_Int2 max)); 371 Nlm_Int2 Nlm_GetSwitchMax PROTO((Nlm_SwitcH s)); 372 void Nlm_SetSwitchParams PROTO((Nlm_SwitcH s, Nlm_Int2 value, Nlm_Int2 max)); 373 374 /*** TEXT OBJECTS ***/ 375 376 /*** Editable Text Objects ***/ 377 378 /* 379 * A Dialog text item contains a single line of text, and pressing the 380 * tab key will step between individual dialog text items in the front 381 * window. A Scroll text box can hold multiple lines of text. 382 */ 383 384 Nlm_TexT Nlm_DialogText PROTO((Nlm_GrouP prnt, Nlm_CharPtr dfault, Nlm_Int2 charWidth, Nlm_TxtActnProc actn)); 385 Nlm_TexT Nlm_HiddenText PROTO((Nlm_GrouP prnt, Nlm_CharPtr dfault, Nlm_Int2 charWidth, Nlm_TxtActnProc actn, Nlm_TxtActnProc tabProc, Nlm_TxtActnProc rtnProc)); 386 Nlm_TexT Nlm_SpecialText PROTO((Nlm_GrouP prnt, Nlm_CharPtr dfault, Nlm_Int2 charWidth, Nlm_TxtActnProc actn, Nlm_TxtActnProc tabProc, Nlm_TxtActnProc rtnProc)); 387 Nlm_TexT Nlm_PasswordText PROTO((Nlm_GrouP prnt, Nlm_CharPtr dfault, Nlm_Int2 charWidth, Nlm_TxtActnProc actn)); 388 Nlm_TexT Nlm_ScrollText PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_FonT font, Nlm_Boolean wrap, Nlm_TxtActnProc actn)); 389 390 Nlm_TexT Nlm_DialogTextWithFont PROTO((Nlm_GrouP prnt, Nlm_CharPtr dfault, Nlm_Int2 charWidth, Nlm_TxtActnProc actn, Nlm_FonT font)); 391 Nlm_TexT Nlm_SpecialTextWithFont PROTO((Nlm_GrouP prnt, Nlm_CharPtr dfault, Nlm_Int2 charWidth, Nlm_TxtActnProc actn, Nlm_TxtActnProc tabProc, Nlm_TxtActnProc rtnProc, Nlm_FonT font)); 392 393 void Nlm_SetTextSelect PROTO((Nlm_TexT t, Nlm_TxtActnProc slct, Nlm_TxtActnProc dslct)); 394 395 Nlm_TexT Nlm_CurrentText PROTO((void)); 396 397 extern void Nlm_SetScrollTextOffset4 (Nlm_GraphiC t, Nlm_Int4 horiz, 398 Nlm_Int4 vert, Nlm_Boolean savePort); 399 extern void Nlm_GetScrollTextOffset4 (Nlm_GraphiC t, Nlm_Int4Ptr horiz, Nlm_Int4Ptr vert); 400 401 /* return TRUE and selection range [begin,end] -- if there is a selection 402 */ 403 Nlm_Boolean Nlm_TextSelectionRange PROTO((Nlm_TexT t, Nlm_Int4Ptr begin, Nlm_Int4Ptr end)); 404 405 void Nlm_CutText PROTO((Nlm_TexT t)); 406 void Nlm_CopyText PROTO((Nlm_TexT t)); 407 void Nlm_PasteText PROTO((Nlm_TexT t)); 408 void Nlm_ClearText PROTO((Nlm_TexT t)); 409 410 size_t Nlm_TextLength PROTO((Nlm_TexT t)); 411 void Nlm_SelectText PROTO((Nlm_TexT t, Nlm_Int4 begin, Nlm_Int4 end)); 412 void Nlm_SetTextEditable PROTO((Nlm_TexT t, Nlm_Boolean editable)); 413 void Nlm_SetTextCursorBlinkRate PROTO((Nlm_TexT t, Nlm_Int2 msec)); 414 void Nlm_SetTextColor PROTO((Nlm_TexT t, Nlm_Uint4 r, Nlm_Uint4 g, Nlm_Uint4 b)); 415 void Nlm_SetKeepCrNlTextFieldCallback PROTO((Nlm_TexT t)); 416 417 /* return the new insertion position in the text(it may differ from "pos" 418 * if an error occurred or "pos" is out of limits) 419 */ 420 Nlm_Int4 Nlm_SetTextCursorPos PROTO((Nlm_TexT t, Nlm_Int4 pos)); 421 422 Nlm_Int4 Nlm_GetTextCursorPos PROTO((Nlm_TexT t)); 423 424 425 426 /*** Static Prompt Objects ***/ 427 428 /* 429 * The static prompt is not editable, but is used to display status 430 * information or instructions to the user. 431 */ 432 433 Nlm_PrompT Nlm_StaticPrompt PROTO((Nlm_GrouP prnt, Nlm_CharPtr title, Nlm_Int2 pixwidth, Nlm_Int2 pixheight, Nlm_FonT font, Nlm_Char just)); 434 435 /*** Display Object ***/ 436 437 /* 438 * The currently selected display object in the front window receives 439 * the output that is sent to the terminal file. 440 */ 441 442 Nlm_DisplaY Nlm_NormalDisplay PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height)); 443 444 Nlm_DisplaY Nlm_ScrollDisplay PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height)); 445 446 /*** SIMPLE UNIVERSAL DRAWING OBJECT ***/ 447 448 /* 449 * A panel object is a rectangular box on a window that provides a universal 450 * drawing environment. Panels translate click actions and drawing requests 451 * to instance-specific procedures. The SimplePanel and AutonomousPanel objects 452 * are autonomous in that they create a single object within a window or group. 453 * (The more general and complex slate/panel combinations are discussed in the 454 * next section.) SetPanelClick assigns click, drag, hold and release callbacks 455 * to a given panel. SimplePanels have only the minimum parameters to specify a 456 * panel, and it is expected that the specific application callbacks for click, 457 * draw, etc., will handle the entire behavior of the panel. 458 * 459 * AutonomousPanels allow the creation of higher-level graphical objects that 460 * can function like built-in Vibrant control objects while allowing much fancier 461 * graphical display and manipulation. The extra parameter specifies the number 462 * of extra bytes to be placed on top of the panel instance data, and the data 463 * can be accessed with SetPanelExtra and GetPanelExtra. The reset callback is 464 * called via the Reset class function, and should be used to free any instance- 465 * specific allocated memory that may be pointed to in the extra data. In order 466 * to override certain class functions (e.g., to allow SetTitle to apply to a 467 * particular autonomous panel), the classPtr function can point to a GphPrcs 468 * array (in static or heap memory). Any function pointer that is not NULL will 469 * override the standard function. 470 * 471 * The purpose of providing separate slates and panels (see next section) is to 472 * allow multiple independent panels to be placed in the same scrolling unit. 473 * The slate handles scrolling, and the individual panel children have their 474 * own click and draw callbacks. Slates are distinguished internally from 475 * autonomous panels because their click through reset procedures are all NULL. 476 */ 477 478 Nlm_PaneL Nlm_SimplePanel PROTO((Nlm_GrouP prnt, Nlm_Int2 pixwidth, Nlm_Int2 pixheight, Nlm_PnlActnProc draw)); 479 480 Nlm_PaneL Nlm_AutonomousPanel4 PROTO((Nlm_GrouP prnt, Nlm_Int2 pixwidth, Nlm_Int2 pixheight, Nlm_PnlActnProc draw, Nlm_SltScrlProc4 vscrl, Nlm_SltScrlProc4 hscrl, Nlm_Int2 extra, Nlm_PnlActnProc reset, Nlm_GphPrcsPtr classPtr)); 481 Nlm_PaneL Nlm_AutonomousPanel PROTO((Nlm_GrouP prnt, Nlm_Int2 pixwidth, Nlm_Int2 pixheight, Nlm_PnlActnProc draw, Nlm_SltScrlProc vscrl, Nlm_SltScrlProc hscrl, Nlm_Int2 extra, Nlm_PnlActnProc reset, Nlm_GphPrcsPtr classPtr)); 482 483 484 #ifdef _OPENGL 485 void Nlm_Set3DColorMap PROTO((Nlm_PaneL w, Nlm_Uint2 totalColors, 486 Nlm_Uint1Ptr red, Nlm_Uint1Ptr green, 487 Nlm_Uint1Ptr blue, void **display)); 488 489 490 Nlm_PaneL Nlm_Autonomous3DPanel PROTO((Nlm_GrouP prnt, Nlm_Int2 pixwidth, 491 Nlm_Int2 pixheight, Nlm_PnlActnProc draw, 492 Nlm_SltScrlProc vscrl, Nlm_SltScrlProc hscrl, 493 Nlm_Int2 extra, Nlm_PnlActnProc reset, 494 Nlm_GphPrcsPtr classPtr, Nlm_Boolean *IndexMode, 495 void **display, void **visinfo)); 496 #endif /* _OPENGL */ 497 498 499 500 void Nlm_SetPanelClick PROTO((Nlm_PaneL p, Nlm_PnlClckProc click, Nlm_PnlClckProc drag, Nlm_PnlClckProc hold, Nlm_PnlClckProc release)); 501 502 void Nlm_SetPanelExtra PROTO((Nlm_PaneL p, Nlm_VoidPtr sptr)); 503 void Nlm_GetPanelExtra PROTO((Nlm_PaneL p, Nlm_VoidPtr sptr)); 504 505 /*** GENERALIZED SCROLLABLE DRAWING OBJECT ***/ 506 507 /* 508 * A slate object is a rectangular box on a window that provides a universal 509 * drawing environment to its panel object children. Panels translate click 510 * actions and drawing requests to instance-specific procedures. The parent 511 * slate must be notified of individual row and column pixel offsets, and of 512 * the corresponding row heights and column widths, in order for slate scroll 513 * bars to work automatically. The panel must be notified of the actual size 514 * of its virtual rectangle. The panel instance procedures should use the 515 * GetOffset procedure to determine the pixel offset for purposes of drawing 516 * and responding to clicks. The VirtualSlate procedure allows specification 517 * of virtual scroll positions before and after the real scroll positions in 518 * a slate. When the user drags the scroll bar thumb into a virtual area, the 519 * virtual action callback should be used to load new data into the slate. 520 * The GeneralSlate allows the specification of an alternative scroll bar 521 * callback procedure for a scrolling slate, as well as extra instance space 522 * and an overriding class function, in order to effectively have an autonomous 523 * scrolling panel. The default scroll bar procedure should be sufficient 524 * for most situations. Superimposed panels, or derivatives of panels, can be 525 * used to build complicated behaviors using simpler objects. 526 */ 527 528 Nlm_SlatE Nlm_ScrollSlate PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height)); 529 Nlm_SlatE Nlm_NormalSlate PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height)); 530 Nlm_SlatE Nlm_HiddenSlate PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height)); 531 Nlm_SlatE Nlm_GeneralSlate PROTO((Nlm_GrouP prnt, Nlm_Int2 width, Nlm_Int2 height, Nlm_SltScrlProc scrl, Nlm_Int2 extra, Nlm_GphPrcsPtr classPtr)); 532 void Nlm_VirtualSlate PROTO((Nlm_SlatE s, Nlm_Int2 before, Nlm_Int2 after, Nlm_SltScrlProc actn)); 533 534 void Nlm_RegisterRow PROTO((Nlm_SlatE s, Nlm_Int2 position, Nlm_Int2 height, Nlm_Int2 count)); 535 void Nlm_RegisterColumn PROTO((Nlm_SlatE s, Nlm_Int2 position, Nlm_Int2 width, Nlm_Int2 count)); 536 537 Nlm_BaR Nlm_GetSlateVScrollBar PROTO((Nlm_SlatE s)); 538 Nlm_BaR Nlm_GetSlateHScrollBar PROTO((Nlm_SlatE s)); 539 540 Nlm_PaneL Nlm_CustomPanel PROTO((Nlm_SlatE s, Nlm_PnlActnProc draw, Nlm_Int2 extra, Nlm_PnlActnProc reset)); 541 Nlm_PaneL Nlm_GeneralPanel PROTO((Nlm_SlatE s, Nlm_PnlActnProc draw, Nlm_Int2 extra, Nlm_PnlActnProc reset, Nlm_GphPrcsPtr classPtr)); 542 543 void Nlm_RegisterRect PROTO((Nlm_PaneL p, Nlm_RectPtr r)); 544 545 void Nlm_SetSlateChar PROTO((Nlm_SlatE s, Nlm_SltCharProc chr)); 546 void Nlm_CaptureSlateFocus PROTO((Nlm_SlatE s)); 547 548 void Nlm_SetSlateBorder PROTO((Nlm_SlatE s, Nlm_Boolean turnon)); /* dgg -- let us turn this adornment on/off */ 549 550 /* SLATE NAVIGATION AND FOCUS POLICY */ 551 #define GET_VALUE 0x1 /* do nothing but return current slate polycy */ 552 #define VERT_PAGE 0x2 /* control the slate scrollbar by PgUp/PgDn keys */ 553 #define HORIZ_PAGE 0x4 /* control the slate scrollbar by Home/End keys */ 554 #define VERT_ARROW 0x8 /* control the slate scrollbar by vert. arrow keys */ 555 #define HORIZ_ARROW 0x10 /* control the slate scrollbar by horiz.arrow keys */ 556 #define AUTO_FOCUS 0x20 /* capture input focus when clicking on the slate */ 557 #define FOCUS_NAVIG 0x40 /* handle navig.keys when the slate is having focus, 558 even if the slate has registered its own keyProc */ 559 #define DEFAULT_SLATE_POLICY (VERT_PAGE | HORIZ_PAGE | VERT_ARROW | HORIZ_ARROW | AUTO_FOCUS) 560 561 /* Set new, return previous policy */ 562 Nlm_Int4 Nlm_SetSlatePolicy PROTO((Nlm_SlatE s, Nlm_Int4 flag)); 563 564 565 /*** APPLICATION CHARACTER PROCEDURE ***/ 566 567 /* 568 * The KeyboardView procedure specifies an application procedure to be 569 * called whenever the user presses a key on the keyboard, regardless of 570 * other action to be taken in response to that event. 571 */ 572 573 void Nlm_KeyboardView PROTO((Nlm_KeyProc key)); 574 575 /*** PRINTING PROCEDURES ***/ 576 577 Nlm_WindoW Nlm_StartPrinting PROTO((void)); 578 void Nlm_EndPrinting PROTO((Nlm_WindoW w)); 579 580 Nlm_Boolean Nlm_StartPage PROTO((void)); 581 Nlm_Boolean Nlm_EndPage PROTO((void)); 582 583 Nlm_Boolean Nlm_PrintingRect PROTO((Nlm_RectPtr rpt)); 584 Nlm_Boolean Nlm_ClipPrintingRect PROTO((const Nlm_RecT PNTR rpt)); 585 586 /*** PICTURE TO CLIPBOARD PROCEDURES ***/ 587 588 Nlm_WindoW Nlm_StartPicture PROTO((Nlm_RectPtr r)); 589 void Nlm_EndPicture PROTO((Nlm_WindoW w)); 590 591 /*** STRING TO AND FROM CLIPBOARD PROCEDURES ***/ 592 593 void Nlm_StringToClipboard PROTO((Nlm_CharPtr str)); 594 Nlm_CharPtr Nlm_ClipboardToString PROTO((void)); 595 Nlm_Boolean Nlm_ClipboardHasString PROTO((void)); 596 597 /*** FILE SPECIFICATION PROCEDURES ***/ 598 599 Nlm_Boolean Nlm_GetInputFileName PROTO((Nlm_CharPtr fileName, size_t maxsize, Nlm_CharPtr extType, Nlm_CharPtr macType)); 600 Nlm_Boolean Nlm_GetOutputFileName PROTO((Nlm_CharPtr fileName, size_t maxsize, Nlm_CharPtr dfault)); 601 602 /*** APPLICATION TIMER PROCEDURE ***/ 603 604 /* 605 * The Metronome procedure specifies an application procedure to be called 606 * 18 or 20 times per second (on the PC and the Macintosh, respectively) 607 * regardless of any action by the user. 608 */ 609 610 void Nlm_Metronome PROTO((Nlm_VoidProc actn)); 611 612 /* 613 * Each window can have a timer associated with it, called right after 614 * the metronome callback. 615 */ 616 617 void Nlm_SetWindowTimer PROTO((Nlm_WindoW w, Nlm_WndActnProc actn)); 618 619 /*** MOUSE MOVEMENT PROCEDURE ***/ 620 621 void Nlm_SetMouseMoveCallback (Nlm_ClckProc actn); 622 623 void Nlm_SetMouseMoveRegion (Nlm_RegioN rgn); 624 625 /*** MISCELLANEOUS HOOKS ***/ 626 627 extern void Nlm_SetButtonAction (Nlm_BtnActnProc actn); 628 extern void Nlm_SetMenuAction (Nlm_ItmActnProc actn); 629 630 /*** MAIN EVENT LOOP PROCEDURE ***/ 631 632 /* 633 * After creating all menus, windows, and window objects, the Nlm_Main 634 * procedure should call ProcessEvents. ProcessEvents will convert all 635 * toolbox events or messages into calls to the appropriate object. 636 */ 637 638 void Nlm_ProcessEvents PROTO((void)); 639 640 /*** QUIT PROGRAM PROCEDURE ***/ 641 642 /* 643 * When a callback function determines that the program is finished it 644 * should call QuitProgram. This will allow the ProcessEvents loop to 645 * be exited. 646 */ 647 648 void Nlm_QuitProgram PROTO((void)); 649 650 651 /* Return TRUE if QuitProgram() has been called 652 */ 653 Nlm_Boolean Nlm_QuittingProgram PROTO((void)); 654 655 656 /*** PROCEDURES THAT ATTACH CALLBACKS TO INTERFACE OBJECTS ***/ 657 658 /* 659 * Given a handle to an object, these procedures will set callback 660 * functions for various kinds of events. The action procedure is 661 * executed whenever the user does something like clicking the mouse 662 * button on an object and then releasing the mouse button while 663 * the mouse is still over the object. The item parameter is 0 to 664 * refer to a parent or individual object, and is >0 to refer to a 665 * particular child of a group object. Although only some of the 666 * above procedures take an action as an explicit parameter, every 667 * graphic object has an action procedure field, which can be set 668 * or reset as desired. 669 */ 670 671 void Nlm_SetAction PROTO((Nlm_Handle a, Nlm_ActnProc actn)); 672 673 /*** PROCEDURES THAT MODIFY INTERFACE OBJECTS ***/ 674 675 /*** Object Position and Appearance Procedures ***/ 676 677 /* 678 * When an object is added to a window or group, it is placed at the 679 * next available location. The parent then records the size and 680 * position of the object and recalculates the next available location. 681 * Advance will place the next object to the right of the previous one 682 * (normally it would be placed below the previous object). Break will 683 * place the next object at the left margin underneath all previously 684 * defined objects, and will reset the top margin so that Advance will 685 * work properly. SetNextPosition and GetNextPosition give programs 686 * finer control over object positioning, including the ability to 687 * overlap objects. Creating a group with width and height equal to 0 688 * will also result in overlapped objects. 689 */ 690 691 void Nlm_Advance PROTO((Nlm_Handle a)); 692 void Nlm_Break PROTO((Nlm_Handle a)); 693 694 void Nlm_SetNextPosition PROTO((Nlm_Handle a, Nlm_PoinT nps)); 695 void Nlm_GetNextPosition PROTO((Nlm_Handle a, Nlm_PointPtr nps)); 696 697 /*** Item Count Procedure ***/ 698 699 /* 700 * CountItems returns the number of items in a parent object. 701 */ 702 703 Nlm_Int2 Nlm_CountItems PROTO((Nlm_Handle a)); 704 705 /*** Object Visibility and Responsiveness Procedures ***/ 706 707 /* 708 * Show makes any object visible (unless, for example, the parent of the 709 * object happens to be invisible). All objects except windows are shown 710 * when they are created. Hide will make any object invisible. Enable 711 * and Disable change the responsiveness of an object to mouse clicks and 712 * key presses. All objects are enabled when created. Select is used to 713 * bring windows to the front, to select a dialog text item, or to select 714 * a particular display object for use as a console terminal display. 715 */ 716 717 Nlm_Boolean Nlm_Enabled PROTO((Nlm_Handle a)); 718 Nlm_Boolean Nlm_Visible PROTO((Nlm_Handle a)); 719 void Nlm_ObjectRect PROTO((Nlm_Handle a, Nlm_RectPtr r)); 720 void Nlm_InvalObject PROTO((Nlm_Handle a)); 721 722 void Nlm_Show PROTO((Nlm_Handle a)); 723 void Nlm_Hide PROTO((Nlm_Handle a)); 724 void Nlm_Enable PROTO((Nlm_Handle a)); 725 void Nlm_Disable PROTO((Nlm_Handle a)); 726 void Nlm_Select PROTO((Nlm_Handle a)); 727 728 /*** Object Title and State Manipulation Procedures ***/ 729 730 /* 731 * The status of an object is polled with one of the following procedures. 732 * Title refers to the title or prompt of an object. Three kinds of values 733 * are recognized: Groups of radio buttons, single choice lists, and menu 734 * choice groups have elements that are mutually exclusive, and thus have a 735 * single integer as their value. The SetValue and GetValue procedures are 736 * appropriate for these objects. Boolean objects (check boxes, status items) 737 * use SetStatus and GetStatus. GetNextItem will find the first set Boolean 738 * item after prev, and will return 0 if there are no more set items. Text 739 * objects use SetTitle and GetTitle. SetOffset and GetOffset will manipulate 740 * the scroll bar offsets for any object. SetPosition and GetPosition 741 * manipulate the position of an object. SetRange is used to set the page 742 * increment and maximum values for a scroll bar. Reset will clear the value 743 * of an object or remove all children from a group. 744 */ 745 746 void Nlm_SetTitle PROTO((Nlm_Handle a, Nlm_CharPtr title)); 747 void Nlm_GetTitle PROTO((Nlm_Handle a, Nlm_CharPtr title, size_t maxsize)); 748 void Nlm_SetValue PROTO((Nlm_Handle a, Nlm_Int2 value)); 749 Nlm_Int2 Nlm_GetValue PROTO((Nlm_Handle a)); 750 void Nlm_SetStatus PROTO((Nlm_Handle a, Nlm_Boolean status)); 751 Nlm_Boolean Nlm_GetStatus PROTO((Nlm_Handle a)); 752 void Nlm_SetOffset PROTO((Nlm_Handle a, Nlm_Int2 horiz, Nlm_Int2 vert)); 753 void Nlm_GetOffset PROTO((Nlm_Handle a, Nlm_Int2Ptr horiz, Nlm_Int2Ptr vert)); 754 void Nlm_SetPosition PROTO((Nlm_Handle a, Nlm_RectPtr r)); 755 void Nlm_GetPosition PROTO((Nlm_Handle a, Nlm_RectPtr r)); 756 void Nlm_SetRange PROTO((Nlm_Handle a, Nlm_Int2 pgUp, Nlm_Int2 pgDn, Nlm_Int2 max)); 757 void Nlm_AdjustPrnt PROTO((Nlm_Handle a, Nlm_RectPtr r, Nlm_Boolean align)); 758 759 void Nlm_SetItemTitle PROTO((Nlm_Handle a, Nlm_Int2 item, Nlm_CharPtr title)); 760 void Nlm_GetItemTitle PROTO((Nlm_Handle a, Nlm_Int2 item, Nlm_CharPtr title, size_t maxsize)); 761 void Nlm_SetItemStatus PROTO((Nlm_Handle a, Nlm_Int2 item, Nlm_Boolean status)); 762 Nlm_Boolean Nlm_GetItemStatus PROTO((Nlm_Handle a, Nlm_Int2 item)); 763 764 Nlm_Int2 Nlm_GetNextItem PROTO((Nlm_Handle a, Nlm_Int2 prev)); 765 766 void Nlm_Reset PROTO((Nlm_Handle a)); 767 768 /*** Object Destruction Procedure ***/ 769 770 /* 771 * Remove hides an object and then completely disposes of all memory structures 772 * associated with that object. 773 */ 774 775 Nlm_Handle Nlm_Remove PROTO((Nlm_Handle a)); 776 777 /*** MISCELLANEOUS WINDOW AND OBJECT PROCEDURES ***/ 778 779 Nlm_Handle Nlm_Parent PROTO((Nlm_Handle a)); 780 781 void Nlm_RealizeWindow PROTO((Nlm_WindoW w)); 782 void Nlm_IconifyWindow PROTO((Nlm_WindoW w)); 783 Nlm_Boolean Nlm_IconicWindow PROTO((Nlm_WindoW w)); 784 Nlm_WindoW Nlm_WhichWindow PROTO((Nlm_PoinT mouseLoc)); 785 Nlm_Boolean Nlm_InWindow PROTO((Nlm_PoinT mouseLoc)); 786 Nlm_WindoW Nlm_FrontWindow PROTO((void)); 787 Nlm_Boolean Nlm_InFront PROTO((Nlm_WindoW w)); 788 void Nlm_UseWindow PROTO((Nlm_WindoW w)); 789 Nlm_WindoW Nlm_CurrentWindow PROTO((void)); 790 Nlm_Boolean Nlm_UsingWindow PROTO((Nlm_WindoW w)); 791 Nlm_WindoW Nlm_ActiveWindow PROTO((void)); 792 void Nlm_EraseWindow PROTO((Nlm_WindoW w)); 793 Nlm_WindoW Nlm_ParentWindow PROTO((Nlm_Handle a)); 794 Nlm_WindoW Nlm_SavePort PROTO((Nlm_Handle a)); 795 void Nlm_RestorePort PROTO((Nlm_WindoW w)); 796 void Nlm_Update PROTO((void)); 797 Nlm_Boolean Nlm_EventAvail PROTO((void)); 798 void Nlm_FlushEvents PROTO((void)); 799 void Nlm_ProcessAnEvent PROTO((void)); 800 void Nlm_ProcessEventOrIdle PROTO((void)); 801 void Nlm_ProcessExternalEvent PROTO((void)); 802 Nlm_Boolean Nlm_AllParentsEnabled PROTO((Nlm_Handle a)); 803 Nlm_Boolean Nlm_AllParentsVisible PROTO((Nlm_Handle a)); 804 void Nlm_RemoveDyingWindows PROTO((void)); 805 void Nlm_UnloadSegment PROTO((Nlm_VoidProc routineAddr)); 806 Nlm_Boolean Nlm_LaunchApp PROTO((Nlm_CharPtr fileName)); 807 void Nlm_SetBarAnomaly PROTO((Nlm_BaR b, Nlm_Boolean anomaly)); 808 void Nlm_CopyWindowImage PROTO((void)); 809 810 void Nlm_SetObjectExtra PROTO((Nlm_Handle a, Nlm_VoidPtr data, Nlm_FreeProc cleanup)); 811 Nlm_VoidPtr Nlm_GetObjectExtra PROTO((Nlm_Handle a)); 812 813 void Nlm_ProcessUpdatesFirst PROTO((Nlm_Boolean val)); 814 815 /* Bring the parent window of object "a" to the top of Z order; 816 * if the parent window is already shown then(unlike the Nlm_Select()) 817 * do not switch current input focus, otherwise just call Nlm_Show() 818 */ 819 void Nlm_PopupParentWindow PROTO((Nlm_Handle a)); 820 821 /* Run the specified application(executable located in "path"). 822 * The "argv" argument is an array of character pointers to 823 * null-terminated strings. These strings constitute the argument 824 * list available to the new process image. 825 * The "argv" argument vector is terminated by a null pointer. 826 */ 827 extern Nlm_Boolean Nlm_Execv PROTO((const Nlm_Char* path, Nlm_Char *const * argv)); 828 #define Execv Nlm_Execv 829 830 /*** OBJECT ALIGNMENT PROCEDURE FOR USE WITHOUT GROUP REPOSITIONING ***/ 831 832 #if defined(WIN_MAC) || defined(WIN_MAC_QUARTZ) 833 #define Nlm_HANDLE Nlm_Handle 834 #elif defined(WIN_MOTIF) 835 #define Nlm_HANDLE Nlm_Handle 836 #elif defined(WIN_MSWIN) 837 #define Nlm_HANDLE int 838 #elif !defined(WIN_GIF) 839 #error "Vibrant applications must be compiled with WIN_*** defined!!!" 840 #endif 841 842 #define ALIGN_LEFT 1 843 #define ALIGN_RIGHT 2 844 #define ALIGN_CENTER 3 845 #define ALIGN_JUSTIFY 4 846 #define ALIGN_UPPER 5 847 #define ALIGN_LOWER 6 848 #define ALIGN_MIDDLE 7 849 #define ALIGN_VERTICAL 8 850 851 void CDECL Nlm_AlignObjects VPROTO((int align, ...)); 852 853 854 /*** NAVIGATION AND SPECIAL KEY CODES ***/ 855 856 #define NLM_PREV 11 857 #define NLM_NEXT 12 858 #define NLM_END 4 859 #define NLM_HOME 1 860 861 #define NLM_DEL 127 862 #define NLM_INS 5 863 #define NLM_BACK 8 864 #define NLM_ESC 27 865 866 #define NLM_LEFT 28 867 #define NLM_RIGHT 29 868 #define NLM_UP 30 869 #define NLM_DOWN 31 870 871 872 /*** EDIT MENU DEFINES, TYPES AND PROCEDURES ***/ 873 874 #define UNDO_MENU_ITEM "Undo/Z" 875 #define CUT_MENU_ITEM "Cut/X" 876 #define COPY_MENU_ITEM "Copy/C" 877 #define PASTE_MENU_ITEM "Paste/V" 878 #define CLEAR_MENU_ITEM "Clear" 879 #define DELETE_MENU_ITEM "Delete" 880 881 extern Nlm_TexT Nlm_CurrentVisibleText (void); 882 extern void Nlm_StdCutTextProc (Nlm_IteM i); 883 extern void Nlm_StdCopyTextProc (Nlm_IteM i); 884 extern void Nlm_StdPasteTextProc (Nlm_IteM i); 885 extern void Nlm_StdDeleteTextProc (Nlm_IteM i); 886 887 /*** FILE HANDLING PROCEDURES ***/ 888 889 /* 890 * Files do not use the same procedures as other kinds of (visual) objects, and 891 * have separate procedures for creation, manipulation, and destruction. The 892 * fileDone flag is set if the file was successfully opened. The fileDone flag 893 * also indicates whether a read or write statement was successful, and can be 894 * used to determine if the end of a file was detected by a read statement. 895 */ 896 897 void Nlm_ReadText PROTO((FILE *f, Nlm_CharPtr str, size_t maxsize)); 898 void CDECL Nlm_WriteText VPROTO((FILE *f, char *format, ...)); 899 void CDECL Nlm_WriteLog VPROTO((char *format, ...)); 900 901 Nlm_Char Nlm_ReadChar PROTO((FILE *f)); 902 void Nlm_ReadString PROTO((FILE *f, Nlm_CharPtr str, size_t maxsize)); 903 void Nlm_ReadField PROTO((FILE *f, Nlm_CharPtr str, size_t maxsize)); 904 void Nlm_ReadLine PROTO((FILE *f, Nlm_CharPtr str, size_t maxsize)); 905 Nlm_Uint2 Nlm_ReadCard PROTO((FILE *f)); 906 Nlm_Int2 Nlm_ReadInt PROTO((FILE *f)); 907 Nlm_Int4 Nlm_ReadLong PROTO((FILE *f)); 908 Nlm_FloatLo Nlm_ReadReal PROTO((FILE *f)); 909 Nlm_FloatHi Nlm_ReadDouble PROTO((FILE *f)); 910 void Nlm_WriteChar PROTO((FILE *f, Nlm_Char ch)); 911 void Nlm_WriteLn PROTO((FILE *f)); 912 void Nlm_WriteString PROTO((FILE *f, Nlm_CharPtr str)); 913 void Nlm_WriteCard PROTO((FILE *f, Nlm_Uint2 cardval, Nlm_Int2 length)); 914 void Nlm_WriteInt PROTO((FILE *f, Nlm_Int2 intval, Nlm_Int2 length)); 915 void Nlm_WriteLong PROTO((FILE *f, Nlm_Int4 longval, Nlm_Int2 length)); 916 void Nlm_WriteReal PROTO((FILE *f, Nlm_FloatLo realval, Nlm_Int2 length, Nlm_Int2 dec)); 917 void Nlm_WriteDouble PROTO((FILE *f, Nlm_FloatHi doubleval, Nlm_Int2 length, Nlm_Int2 dec)); 918 919 920 /*** esl: FONT HANDLING PROCEDURES ***/ 921 922 /* Interactive font selection (last param should be NULL for this version) */ 923 Nlm_Boolean Nlm_ChooseFont PROTO((Nlm_FontSpecPtr fsp, Nlm_Uint2 flags, Nlm_VoidPtr null)); 924 #define CFF_READ_FSP 1 925 #define CFF_MONOSPACE 2 926 927 /* FontSpec/string conversions */ 928 Nlm_Boolean Nlm_StrToFontSpec PROTO((Nlm_CharPtr str, Nlm_FontSpecPtr fsp)); 929 void Nlm_FontSpecToStr PROTO((Nlm_FontSpecPtr fsp, Nlm_CharPtr str, size_t maxsize)); 930 931 932 /*** STRING HANDLING PROCEDURES ***/ 933 934 /* To compose a printable text for multiline TexT objects for all platforms. 935 * The resulting string will contain only printable characters(and '\n', '\t' 936 * and (on non-WIN_MAC platforms) '\r'). 937 * On non-Mac platforms insert '\r' before '\n' symbols not preceeded 938 * by '\r'; otherwise, remove all '\r' symbols and replace '\n' by '\015'. 939 * NB: The caller is responsible to free the memory allocated for the result. 940 */ 941 Nlm_CharPtr Nlm_StrngPrintable PROTO((const Nlm_Char PNTR str)); 942 943 /* 944 * These string functions are intended to be both robust and portable 945 * across all operating systems that the NCBI toolbox will support. 946 * The maxsize parameter is usually passed sizeof (dest), and will 947 * prevent characters from being written past the allocated memory of 948 * a string. 949 */ 950 951 Nlm_Uint4 Nlm_StrngLen PROTO((Nlm_CharPtr string)); 952 void Nlm_StrngCat PROTO((Nlm_CharPtr dest, Nlm_CharPtr source, size_t maxsize)); 953 void Nlm_StrngCpy PROTO((Nlm_CharPtr dest, Nlm_CharPtr source, size_t maxsize)); 954 Nlm_Boolean Nlm_StrngPos PROTO((Nlm_CharPtr str, Nlm_CharPtr sub, Nlm_Uint4 start, Nlm_Boolean caseCounts, Nlm_Uint4Ptr match)); 955 void Nlm_StrngSeg PROTO((Nlm_CharPtr dest, Nlm_CharPtr source, Nlm_Uint4 start, Nlm_Uint4 length, size_t maxsize)); 956 void Nlm_StrngRep PROTO((Nlm_CharPtr dest, Nlm_CharPtr source, Nlm_Uint4 start, size_t maxsize)); 957 Nlm_Boolean Nlm_StrngEql PROTO((Nlm_CharPtr str1, Nlm_CharPtr str2, Nlm_Boolean caseCounts)); 958 Nlm_Int2 Nlm_StrngCmp PROTO((Nlm_CharPtr str1, Nlm_CharPtr str2, Nlm_Boolean caseCounts)); 959 Nlm_Int2 Nlm_SymblCmp PROTO((Nlm_CharPtr str1, Nlm_CharPtr str2, Nlm_Boolean caseCounts)); 960 961 /*** STRING TO NUMBER CONVERSION PROCEDURES ***/ 962 963 /* 964 * The boolean value returned by the String to Number functions indicates 965 * whether the conversion was successful (meaning that the string was in 966 * fact a legitimate number in the proper range). 967 */ 968 969 Nlm_Boolean Nlm_StrToCard PROTO((Nlm_CharPtr str, Nlm_Uint2Ptr cardval)); 970 Nlm_Boolean Nlm_StrToInt PROTO((Nlm_CharPtr str, Nlm_Int2Ptr intval)); 971 Nlm_Boolean Nlm_StrToLong PROTO((Nlm_CharPtr str, Nlm_Int4Ptr longval)); 972 Nlm_Boolean Nlm_StrToPtr PROTO((Nlm_CharPtr str, Nlm_VoidPtr PNTR ptrval)); 973 Nlm_Boolean Nlm_StrToReal PROTO((Nlm_CharPtr str, Nlm_FloatLoPtr realval)); 974 Nlm_Boolean Nlm_StrToDouble PROTO((Nlm_CharPtr str, Nlm_FloatHiPtr doubleval)); 975 void Nlm_CardToStr PROTO((Nlm_Uint2 cardval, Nlm_CharPtr str, Nlm_Int2 length, size_t maxsize)); 976 void Nlm_IntToStr PROTO((Nlm_Int2 intval, Nlm_CharPtr str, Nlm_Int2 length, size_t maxsize)); 977 void Nlm_LongToStr PROTO((Nlm_Int4 longval, Nlm_CharPtr str, Nlm_Int2 length, size_t maxsize)); 978 void Nlm_PtrToStr PROTO((Nlm_VoidPtr ptrval, Nlm_CharPtr str, Nlm_Int2 length, size_t maxsize)); 979 void Nlm_RealToStr PROTO((Nlm_FloatLo realval, Nlm_CharPtr str, Nlm_Int2 length, Nlm_Int2 dec, size_t maxsize)); 980 void Nlm_DoubleToStr PROTO((Nlm_FloatHi doubleval, Nlm_CharPtr str, Nlm_Int2 length, Nlm_Int2 dec, size_t maxsize)); 981 982 /*** SPECIALIZED MEMORY ALLOCATION PROCEDURES ***/ 983 984 /* 985 * SetString and GetString are used to conveniently copy C strings to 986 * and from relocatable memory allocated on the heap. 987 */ 988 989 Nlm_Handle Nlm_SetString PROTO((Nlm_Handle h, Nlm_CharPtr str)); 990 void Nlm_GetString PROTO((Nlm_Handle h, Nlm_CharPtr str, size_t maxsize)); 991 992 993 /*** MISCELLANEOUS PROCEDURES ***/ 994 995 996 /* 997 * The supported cursor shapes 998 */ 999 1000 void Nlm_ArrowCursor PROTO((void)); 1001 void Nlm_CrossCursor PROTO((void)); 1002 void Nlm_IBeamCursor PROTO((void)); 1003 void Nlm_PlusCursor PROTO((void)); 1004 void Nlm_WatchCursor PROTO((void)); 1005 1006 typedef enum 1007 { 1008 Nlm_CURSOR_ARROW = 0, 1009 #define CURSOR_ARROW Nlm_CURSOR_ARROW 1010 #define CURSOR_DEFAULT Nlm_CURSOR_ARROW 1011 Nlm_CURSOR_CROSS, 1012 #define CURSOR_CROSS Nlm_CURSOR_CROSS 1013 Nlm_CURSOR_IBEAM, 1014 #define CURSOR_IBEAM Nlm_CURSOR_IBEAM 1015 Nlm_CURSOR_PLUS, 1016 #define CURSOR_PLUS Nlm_CURSOR_PLUS 1017 Nlm_CURSOR_WATCH, 1018 #define CURSOR_WATCH Nlm_CURSOR_WATCH 1019 1020 /* add new cursor shape IDs before this comment */ 1021 1022 Nlm_N_CURSORS, 1023 #define N_CURSORS Nlm_N_CURSORS 1024 Nlm_WHAT_CURSOR, 1025 #define WHAT_CURSOR Nlm_WHAT_CURSOR 1026 Nlm_BAD_CURSOR 1027 #define BAD_CURSOR Nlm_BAD_CURSOR 1028 } 1029 Nlm_enumCursorShape; 1030 #define enumCursorShape Nlm_enumCursorShape 1031 1032 /* 1033 * All new cursor shapes should be added within this function 1034 */ 1035 Nlm_Boolean Nlm_InitCursorShapes PROTO( ( void ) ); 1036 #define InitCursorShapes Nlm_InitCursorShapes 1037 1038 /* 1039 * on success, set current cursor shape to "cursor_shape" and 1040 * return previously set cursor shape; 1041 * on error, return BAD_CURSOR; 1042 * if "cursor_shape" == WHAT_CURSOR then do nothing but 1043 * return previously set cursor shape 1044 */ 1045 enumCursorShape Nlm_SetCursorShape PROTO((enumCursorShape cursor_shape)); 1046 #define SetCursorShape Nlm_SetCursorShape 1047 1048 1049 /* 1050 * Etc 1051 */ 1052 1053 void Nlm_Version PROTO((Nlm_CharPtr vsn, size_t maxsize)); 1054 1055 void Nlm_MousePosition PROTO((Nlm_PointPtr pt)); 1056 Nlm_Boolean Nlm_MouseButton PROTO((void)); 1057 Nlm_Int4 Nlm_ComputerTime PROTO((void)); 1058 1059 #ifdef WIN_MSWIN 1060 void Nlm_DisableVibrant PROTO((void)); 1061 void Nlm_EnableVibrant PROTO((void)); 1062 #endif /* WIN_MSWIN */ 1063 1064 /* dgg++ added for use w/ DCLAP c++ library */ 1065 void Nlm_SetObject PROTO((Nlm_GraphiC a, Nlm_VoidPtr thisobject)); 1066 Nlm_VoidPtr Nlm_GetObject PROTO((Nlm_GraphiC a)); 1067 1068 #ifdef WIN_MAC 1069 extern void Nlm_SendOpenDocAppleEvent PROTO((Nlm_CharPtr datafile, Nlm_CharPtr sig)); 1070 extern void Nlm_SendOpenDocAppleEventEx PROTO((Nlm_CharPtr datafile, Nlm_CharPtr sig, Nlm_CharPtr prog, Nlm_Boolean wantReply)); 1071 extern void Nlm_SendURLAppleEvent (Nlm_CharPtr urlString, Nlm_CharPtr sig, Nlm_CharPtr prog); 1072 extern void Nlm_SendAppleScriptString (Nlm_CharPtr script); 1073 #endif 1074 1075 #ifdef WIN_MSWIN 1076 /* Call application registered to open the given type of document. 1077 * The doc type is recognized automagically using the file extention; 1078 * if the doc is URL then its name must explicitely start from "http://". 1079 */ 1080 extern Nlm_Boolean Nlm_MSWin_OpenDocument(const Nlm_Char* doc_name); 1081 1082 /* Call program (e.g., Cn3D) with parameters (e.g., data file name) */ 1083 extern Nlm_Boolean Nlm_MSWin_OpenApplication(const Nlm_Char* program, const Nlm_Char* parameters); 1084 extern void Nlm_GetExecPath(char *filetype, char *buf, int buflen); 1085 #endif 1086 1087 #ifdef WIN_MOTIF 1088 extern void Nlm_SetMotifWindowName PROTO((Nlm_CharPtr nm)); 1089 #endif 1090 1091 extern Nlm_Boolean Nlm_ChooseColorDialog PROTO(( 1092 Nlm_Uint1 PNTR redptr,Nlm_Uint1 PNTR greenptr, Nlm_Uint1 PNTR blueptr, 1093 Nlm_Boolean Initial )); 1094 1095 extern void LIBCALL Nlm_RegisterDropProc PROTO((Nlm_DropProc dropProc)); 1096 extern void LIBCALL Nlm_RegisterServiceProc PROTO((Nlm_ServiceProc serviceProc)); 1097 extern void LIBCALL Nlm_RegisterResultProc PROTO((Nlm_ResultProc resultProc)); 1098 1099 #ifdef OS_UNIX 1100 extern void Nlm_FineGranularitySleep PROTO((Int4 seconds, Int4 microseconds)); 1101 #endif 1102 1103 #ifdef WIN_MOTIF 1104 extern void Nlm_WaitForXEvent PROTO((void)); 1105 #define Nlm_WaitForCondition(cond) { \ 1106 while (cond) { \ 1107 Nlm_WaitForXEvent(); \ 1108 Nlm_ProcessExternalEvent(); \ 1109 } \ 1110 } 1111 #else 1112 #define Nlm_WaitForCondition(cond) while (cond) { Nlm_ProcessExternalEvent(); } 1113 #endif /* WIN_MOTIF */ 1114 1115 #ifdef WIN_MOTIF 1116 typedef enum 1117 { 1118 Nlm_IO_READ, /* file descriptor has data available */ 1119 Nlm_IO_WRITE, /* file descriptor available for writing */ 1120 Nlm_IO_ERROR, /* I/O error(exception) occurred */ 1121 Nlm_IO_CLEANUP /* when called from UnregisterIO() */ 1122 } Nlm_IOtype; 1123 1124 struct Nlm_IOstruct; 1125 typedef struct Nlm_IOstruct PNTR Nlm_IO; 1126 1127 /* IO callback function */ 1128 typedef void (*Nlm_IOcallback)(Nlm_IO io, int fd, Nlm_IOtype type, 1129 Nlm_VoidPtr udata); 1130 1131 extern Nlm_IO Nlm_RegisterIO PROTO((int fd, 1132 Nlm_IOcallback ufunc, Nlm_VoidPtr udata, 1133 Nlm_IOtype type)); 1134 extern void Nlm_UnregisterIO PROTO((Nlm_IO io)); 1135 #endif /* WIN_MOTIF */ 1136 1137 1138 #ifdef __cplusplus 1139 } 1140 #endif 1141 1142 #endif 1143 1144