1 /** 2 * @namespace biewlib 3 * @file biewlib/twin.h 4 * @brief This file contains prototypes of Text Window manager functions. 5 * @version - 6 * @remark this source file is part of Binary vIEW project (BIEW). 7 * The Binary vIEW (BIEW) is copyright (C) 1995 Nickols_K. 8 * All rights reserved. This software is redistributable under the 9 * licence given in the file "Licence.en" ("Licence.ru" in russian 10 * translation) distributed in the BIEW archive. 11 * @note Requires POSIX compatible development system 12 * 13 * @author Nickols_K 14 * @since 1995 15 * @note Development, fixes and improvements 16 * @warning Program is destroyed, from twPrintF misapplication 17 * @bug Limitation of twPrintF using 18 **/ 19 20 #ifndef __TWIN_H 21 #define __TWIN_H 1 22 23 #ifndef __BIEWLIB_H 24 #include "biewlib/biewlib.h" 25 #endif 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 /** Enumerates all colors used in twin library */ 32 typedef enum 33 { 34 Black = 0, /**< Equivalent of RGB: 0 0 0 */ 35 Blue, /**< Equivalent of RGB: 0 0 128 */ 36 Green, /**< Equivalent of RGB: 0 128 0 */ 37 Cyan, /**< Equivalent of RGB: 0 128 128 */ 38 Red, /**< Equivalent of RGB: 128 0 0 */ 39 Magenta, /**< Equivalent of RGB: 128 0 128 */ 40 Brown, /**< Equivalent of RGB: 128 128 0 */ 41 LightGray, /**< Equivalent of RGB: 192 192 192 */ 42 Gray, /**< Equivalent of RGB: 128 128 128 */ 43 LightBlue, /**< Equivalent of RGB: 0 0 255 */ 44 LightGreen, /**< Equivalent of RGB: 0 255 0 */ 45 LightCyan, /**< Equivalent of RGB: 0 255 255 */ 46 LightRed, /**< Equivalent of RGB: 255 0 0 */ 47 LightMagenta, /**< Equivalent of RGB: 255 0 255 */ 48 Yellow, /**< Equivalent of RGB: 255 255 0 */ 49 White /**< Equivalent of RGB: 255 255 255 */ 50 }Color; 51 52 /* Pseudographics and special characters support 53 Box drawing in short: 54 S - single D - double 55 H - horizontal V - vertical 56 u - up d - down l - left r - right 57 */ 58 59 #define TWC_DEF_FILLER 0x20 /**< default filler char */ 60 61 #ifndef HAVE_TERMINAL_OUT 62 #define TWC_UP_ARROW '' /**< Up arrow character */ 63 #define TWC_DN_ARROW '' /**< Down arrow character */ 64 #define TWC_LT_ARROW '' /**< Left arrow character */ 65 #define TWC_RT_ARROW '' /**< Right arrow character */ 66 #define TWC_THUMB '\xFE'/**< Thumb character */ 67 #else 68 #define TWC_UP_ARROW '^' /**< Up arrow character */ 69 #define TWC_DN_ARROW 'v' /**< Down arrow character */ 70 #define TWC_LT_ARROW '<' /**< Left arrow character */ 71 #define TWC_RT_ARROW '>' /**< Right arrow character */ 72 #define TWC_THUMB '#' /**< Thumb character */ 73 #endif 74 75 #define TWC_RADIO_CHAR '*' /**< Character for radio buttons */ 76 #define TWC_CHECK_CHAR 'x' /**< Character for check buttons */ 77 78 #define TWC_LT_SHADE 0xB0 /**< Light shade characters */ 79 #define TWC_MED_SHADE 0xB1 /**< Medium shade characters */ 80 #define TWC_DK_SHADE 0xB2 /**< Dark shade characters */ 81 82 #define TWC_SV 0xB3 /**< SINGLE VERTICAL */ 83 #define TWC_SV_Sl 0xB4 /**< SINGLE VERTICAL and SINGLE left */ 84 #define TWC_Sl_SV TWC_SV_Sl 85 #define TWC_SV_Dl 0xB5 /**< SINGLE VERTICAL and DOUBLE left */ 86 #define TWC_Dl_SV TWC_SV_Dl 87 #define TWC_DV_Sl 0xB6 /**< DOUBLE VERTICAL and SINGLE left */ 88 #define TWC_Sl_DV TWC_DV_Sl 89 #define TWC_Dd_Sl 0xB7 /**< DOUBLE down and SINGLE left */ 90 #define TWC_Sl_Dd TWC_Dd_Sl 91 #define TWC_Sd_Dl 0xB8 /**< SINGLE down and DOUBLE left */ 92 #define TWC_Dl_Sd TWC_Sd_Dl 93 #define TWC_DV_Dl 0xB9 /**< DOUBLE VERTICAL and DOUBLE left */ 94 #define TWC_Dl_DV TWC_DV_Dl 95 #define TWC_DV 0xBA /**< DOUBLE VERTICAL */ 96 #define TWC_Dd_Dl 0xBB /**< DOUBLE down and DOUBLE left */ 97 #define TWC_Dl_Dd TWC_Dd_Dl 98 #define TWC_Du_Dl 0xBC /**< DOUBLE up and DOUBLE left */ 99 #define TWC_Dl_Du TWC_Du_Dl 100 #define TWC_Du_Sl 0xBD /**< DOUBLE up and SINGLE left */ 101 #define TWC_Sl_Du TWC_Du_Sl 102 #define TWC_Su_Dl 0xBE /**< SINGLE up and DOUBLE left */ 103 #define TWC_Dl_Su TWC_Su_Dl 104 #define TWC_Sd_Sl 0xBF /**< SINGLE down and SINGLE left */ 105 #define TWC_Sl_Sd TWC_Sd_Sl 106 #define TWC_Su_Sr 0xC0 /**< SINGLE up and SINGLE right */ 107 #define TWC_Sr_Su TWC_Su_Sr 108 #define TWC_SH_Su 0xC1 /**< SINGLE HORIZONTAL and SINGLE up */ 109 #define TWC_Su_SH TWC_SH_Su 110 #define TWC_SH_Sd 0xC2 /**< SINGLE HORIZONTAL and SINGLE down */ 111 #define TWC_Sd_SH TWC_SH_Sd 112 #define TWC_SV_Sr 0xC3 /**< SINGLE VERTICAL and SINGLE right */ 113 #define TWC_Sr_SV TWC_SV_Sr 114 #define TWC_SH 0xC4 /**< SINGLE HORIZONTAL */ 115 #define TWC_SH_SV 0xC5 /**< SINGLE HORIZONTAL and SINGLE VERTICAL */ 116 #define TWC_SV_SH TWC_SH_SV 117 #define TWC_SV_Dr 0xC6 /**< SINGLE VERTICAL and DOUBLE right */ 118 #define TWC_Dr_SV TWC_SV_Dr 119 #define TWC_DV_Sr 0xC7 /**< DOUBLE VERTICAL and SINGLE right */ 120 #define TWC_Sr_DV TWC_DV_Sr 121 #define TWC_Du_Dr 0xC8 /**< DOUBLE up and DOUBLE right */ 122 #define TWC_Dr_Du TWC_Du_Dr 123 #define TWC_Dd_Dr 0xC9 /**< DOUBLE down and DOUBLE right */ 124 #define TWC_Dr_Dd TWC_Dd_Dr 125 #define TWC_DH_Du 0xCA /**< DOUBLE HORIZONTAL and DOUBLE up */ 126 #define TWC_Du_DH TWC_DH_Du 127 #define TWC_DH_Dd 0xCB /**< DOUBLE HORIZONTAL and DOUBLE down */ 128 #define TWC_Dd_DH TWC_DH_Dd 129 #define TWC_DV_Dr 0xCC /**< DOUBLE VERTICAL and DOUBLE right */ 130 #define TWC_Dr_DV TWC_DV_Dr 131 #define TWC_DH 0xCD /**< DOUBLE HORIZONTAL */ 132 #define TWC_DH_DV 0xCE /**< DOUBLE HORIZONTAL and DOUBLE VERTICAL */ 133 #define TWC_DV_DH TWC_DH_DV 134 #define TWC_DH_Su 0xCF /**< DOUBLE HORIZONTAL and SINGLE up */ 135 #define TWC_Su_DH TWC_DH_Su 136 #define TWC_SH_Du 0xD0 /**< SINGLE HORIZONTAL and DOUBLE up */ 137 #define TWC_Du_SH TWC_SH_Du 138 #define TWC_DH_Sd 0xD1 /**< DOUBLE HORIZONTAL and SINGLE down */ 139 #define TWC_Sd_DH TWC_DH_Sd 140 #define TWC_SH_Dd 0xD2 /**< SINGLE HORIZONTAL and DOUBLE down */ 141 #define TWC_Dd_SH TWC_SH_Dd 142 #define TWC_Du_Sr 0xD3 /**< DOUBLE up and SINGLE right */ 143 #define TWC_Sr_Du TWC_Du_Sr 144 #define TWC_Su_Dr 0xD4 /**< SINGLE up and DOUBLE right */ 145 #define TWC_Dr_Su TWC_Su_Dr 146 #define TWC_Sd_Dr 0xD5 /**< SINGLE down and DOUBLE right */ 147 #define TWC_Dr_Sd TWC_Sd_Dr 148 #define TWC_Dd_Sr 0xD6 /**< DOUBLE down and SINGLE right */ 149 #define TWC_Sr_Dd TWC_Sr_Dd 150 #define TWC_DV_SH 0xD7 /**< DOUBLE VERTICAL and SINGLE HORIZONTAL */ 151 #define TWC_SH_DV TWC_DV_SH 152 #define TWC_SV_DH 0xD8 /**< SINGLE VERTICAL and DOUBLE HORIZONTAL */ 153 #define TWC_DH_SV TWC_SV_DH 154 #define TWC_Su_Sl 0xD9 /**< SINGLE up and SINGLE left */ 155 #define TWC_Sl_Su TWC_Su_Sl 156 #define TWC_Sd_Sr 0xDA /**< SINGLE down and SINGLE right */ 157 #define TWC_Sr_Sd TWC_Sd_Sr 158 159 #define TWC_FL_BLK 0xDB /**< Full block character */ 160 #define TWC_LW_HBLK 0xDC /**< Lower half block character */ 161 #define TWC_LF_HBLK 0xDD /**< Left half block character */ 162 #define TWC_RT_HBLK 0xDE /**< Right half block character */ 163 #define TWC_UP_HBLK 0xDF /**< Up half block character */ 164 165 #define TWC_BLACK_SQUARE 0xFE /**< Black square */ 166 167 /** Describes window-related coordinate type */ 168 #if __WORDSIZE == 16 169 typedef unsigned char tRelCoord; 170 #else 171 typedef unsigned tRelCoord; 172 #endif 173 174 /** align modes for title and footer */ 175 typedef enum 176 { 177 TW_TMODE_LEFT = 0, /**< left alignment */ 178 TW_TMODE_CENTER, /**< center alignment */ 179 TW_TMODE_RIGHT /**< right alignment */ 180 }tTitleMode; 181 182 /** Flags of twCreateWin */ 183 #define TWS_NONE 0x0000 /**< Indicates no flags @see twCreateWin */ 184 #define TWS_FRAMEABLE 0x0001 /**< Indicates that window has frame border @see twCreateWin */ 185 #define TWS_VISIBLE 0x0002 /**< Indicates that window creates in visible state @see twCreateWin */ 186 #define TWS_CURSORABLE 0x0004 /**< Indicates that window has text cursor @see twCreateWin */ 187 #define TWS_NLSOEM 0x0100 /**< Indicates that window works in OEM mode @see twCreateWin */ 188 189 extern const char TW_SINGLE_FRAME[]; /**< Flat single-line frame @see twinDrawFrame */ 190 extern const char TW_DOUBLE_FRAME[]; /**< Flat double-line frame @see twinDrawFrame */ 191 #define TW_THIN_FRAME TW_SINGLE_FRAME /**< Synonym for TW_SINGLE_LINE @see twinDrawFrame */ 192 extern const char TW_MEDIUM_FRAME[]; /**< Flat frame of medium width (filles 50% of the character cells) @see twinDrawFrame */ 193 extern const char TW_THICK_FRAME[]; /**< Flat frame of full width (filles 100% of the character cells) @see twinDrawFrame */ 194 extern const char TW_UP3D_FRAME[]; /**< Emulates 3D-frame that similar unpressed button @see twinDrawFrame */ 195 extern const char TW_DN3D_FRAME[]; /**< Emulates 3D-frame that similar pressed button @see twinDrawFrame */ 196 197 /** Defines color pair that contains original user color and converted system color */ 198 typedef struct tagDefColor 199 { 200 ColorAttr user; /**< Original user color value */ 201 ColorAttr system; /**< Converted system color value */ 202 }DefColor; 203 204 /** Converts logical foreground and background into physical color attributes */ 205 #define LOGFB_TO_PHYS(fore,back) ((((back) << 4) & 0xF0) | ((fore) & 0x0F)) 206 /** Gets background color from physical attributes */ 207 #define BACK_COLOR(attr) (((attr) >> 4) & 0x0F) 208 /** Gets foreground color from physical attributes */ 209 #define FORE_COLOR(attr) ((attr) & 0x0F) 210 /** Converts physical color attributes into logical foreground and background */ 211 #define PHYS_TO_LOGFB(attr,fore,back) { fore = FORE_COLOR(attr); back = BACK_COLOR(attr); } 212 213 /* 214 This struct is ordered as it documented in Athlon manual 215 Publication # 22007 Rev: D 216 */ 217 /** Internal structure of text window */ 218 typedef struct tagTWindow 219 { 220 char Frame[8]; /**< Buffer, contaning frame component */ 221 /* Frame encoding: 1---2---3 */ 222 /* | | */ 223 /* 4 5 */ 224 /* | | */ 225 /* 6---7---8 */ 226 unsigned long iflags; /**< contains internal flags of window state */ 227 struct tagTWindow *next; /**< pointer to next window in list */ 228 void * usrData; /**< user data pointer */ 229 tvioBuff body; /**< Buffer containing image of window frame */ 230 tvioBuff saved; /**< Buffer containing saved image under window */ 231 char * Title; /**< Caption of window */ 232 char * Footer; /**< Footer of window */ 233 void * method; /**< Class callback */ 234 unsigned class_flags; /**< Class flags */ 235 unsigned wsize; /**< Size of buffers in bytes */ 236 unsigned wwidth; /**< width of window */ 237 unsigned wheight; /**< height of window */ 238 unsigned flags; /**< Window flags */ 239 tAbsCoord X1,Y1,X2,Y2; /**< coordinates of window on the screen */ 240 tRelCoord cur_x,cur_y; /**< coordinates of cursor position inside the window */ 241 tTitleMode TitleMode; /**< alignment mode of title */ 242 tTitleMode FooterMode; /**< alignment mode of footer */ 243 DefColor text; /**< default color of text */ 244 DefColor frame; /**< default color of frame */ 245 DefColor title; /**< default color of title */ 246 DefColor footer; /**< default color of footer text */ 247 }TWindow; 248 249 /* Below located list of window messages. Prefix WM_ was imported from 250 MSWindows SDK, but I hope it so understandable. */ 251 252 #define WM_NULL 0x0000 /**< Never to send */ 253 #define WM_CREATE 0x0001 /**< It sent when window is being created, has no parameters */ 254 #define WM_DESTROY 0x0002 /**< It sent when window is being destroyed, has no parameters*/ 255 #define WM_SHOW 0x0003 /**< It sent when window is being displayed, has no parameters*/ 256 #define WM_TOPSHOW 0x0004 /**< It sent when window is being displayed on top of all windows, has no parameters*/ 257 #define WM_SHOWBENEATH 0x0005 /**< It sent when window is being displayed beneath of other window, has handle of top window as event_data*/ 258 #define WM_HIDE 0x0006 /**< It sent when window is being hidded, has no parameters */ 259 260 /** Calls window function with given arguments 261 * @return function answer 262 * @param event one of WM_* commands 263 * @param event_param command related parameter 264 * @param event_data command related data 265 * @see twcRegisterClass 266 **/ 267 long __FASTCALL__ twinSendMessage(TWindow *win,unsigned event,unsigned long event_param, void *event_data); 268 269 /** Draws frame of given type in active window 270 * @return none 271 * @param x1_,y1_,x2_,y2_ indicate coordinates inside window 272 * @param frame indicates frame type 273 * @param fore,back indicate logical foreground and background attributes 274 * @see twinDrawFrameAttr 275 **/ 276 void __FASTCALL__ twinDrawFrame(tRelCoord x1_, tRelCoord y1_, tRelCoord x2_, tRelCoord y2_,const char *frame,Color fore, Color back); 277 278 /** Draws frame of given type in active window 279 * @return none 280 * @param x1_,y1_,x2_,y2_ indicate coordinates inside window 281 * @param frame indicates frame type 282 * @param attr indicates physical color attributes 283 * @see twinDrawFrame 284 **/ 285 void __FASTCALL__ twinDrawFrameAttr(tRelCoord x1_, tRelCoord y1_, tRelCoord x2_, tRelCoord y2_,const char *frame,ColorAttr attr); 286 287 #define TWIF_FORCEMONO 0x00000001L /**< forces monochrome mode of video output @see twInit */ 288 289 /** Initialization of twin library and video subsystem 290 * @param user_cp indicates character's codepage or IBM866 if NULL 291 * @param vio_flags flags for _init_vio 292 * @param twin_flgs flags of twin library (see above) 293 * @return none 294 * @note Call this function before any other 295 * @see twDestroy 296 **/ 297 void __FASTCALL__ twInit(const char *user_cp, unsigned long vio_flags, unsigned long twin_flgs ); 298 299 /** Terminates twin library and video subsystem 300 * @return none 301 * @note Call this function after all other 302 * @see twInit 303 **/ 304 void __FASTCALL__ twDestroy( void ); 305 306 /** Creates window 307 * @param x1_,y1_ indicate upper-left cornen of window 308 * @param width,height indicate width and height of window 309 * @param flags indicates TWS_* flags 310 * @return handle of window 311 * @see twDestroyWin twCreateWinEx 312 **/ 313 TWindow * __FASTCALL__ twCreateWin(tAbsCoord x1_, tAbsCoord y1_, tAbsCoord width, tAbsCoord height, unsigned flags); 314 315 /** Creates extended window 316 * @param x1_,y1_ indicate upper-left cornen of window 317 * @param width,height indicate width and height of window 318 * @param flags indicates TWS_* flags 319 * @param parent indicates parent window 320 * @param classname indicates name of class 321 * @return handle of window 322 * @note name of class must be registered before 323 calling of this function 324 * @see twDestroyWin twCreateWin twRegisterClass 325 **/ 326 TWindow * __FASTCALL__ twCreateWinEx(tAbsCoord x1_, tAbsCoord y1_, 327 tAbsCoord width, tAbsCoord height, 328 unsigned flags, TWindow *parent, 329 const char *classname); 330 331 /** Destroys given window 332 * @param handle of window 333 * @return none 334 * @see twCreateWin 335 **/ 336 void __FASTCALL__ twDestroyWin(TWindow *win); 337 338 /** Hides given window 339 * @param win handle of window 340 * @return none 341 * @note All operations are available for 342 * hidden window. Does not change 343 * Z-order of window. 344 * @see twShowWin twShowWinBeneath twShowWinOnTop 345 **/ 346 void __FASTCALL__ twHideWin(TWindow *win); 347 348 /** Shows given window. 349 * @param win handle of window 350 * @return none 351 * @note Does not change Z-order of window. 352 * @see twHideWin 353 **/ 354 void __FASTCALL__ twShowWin(TWindow *win); 355 356 /** Shows given window beneath other window. 357 * @param win handle of window 358 * @return none 359 * @note Does change Z-order of window 360 * @see twHideWin 361 **/ 362 void __FASTCALL__ twShowWinBeneath(TWindow *win,TWindow *prev); 363 364 /** Shows given window on the top of the window stack. 365 * @param win handle of window 366 * @return none 367 * @note Does change Z-order of window 368 * @see twHideWin 369 **/ 370 void __FASTCALL__ twShowWinOnTop(TWindow *win); 371 372 /** Updates the window buffer from the screen. 373 * @param win handle of window 374 * @return none 375 **/ 376 void __FASTCALL__ twSnapShot(TWindow *win); 377 378 /** Causes all subsequent output to appear in the given window. 379 * @param win handle of window to be used 380 * @return none 381 * @note \e win need not be the top window; not 382 * does \e win even have to be visible on 383 * the screen. 384 * @see twUsedWin 385 **/ 386 TWindow * __FASTCALL__ twUseWin(TWindow *); 387 388 /** Returns the window currently being used for output. 389 * @return handle of window currently being used 390 * @note If no window has been assigned by 391 * twUse, then handle of last created 392 * window is returned. 393 * @see twUseWin 394 **/ 395 TWindow * __FASTCALL__ twUsedWin( void ); 396 397 /** Alters position of given window. 398 * @param win handle of window to be moved 399 * @param dx,dy specify relative change of x and y coordinates. 400 * @return none 401 * @note The contents of the window will be moved with it. 402 * @see twCentredWin twResizeWin twGetWinPos 403 **/ 404 void __FASTCALL__ twMoveWin(TWindow *win,tAbsCoord dx, tAbsCoord dy); 405 406 /** Alters size of given window. 407 * @param win handle of window to be resized 408 * @param width,height specify new width and height of the window. 409 * @return none 410 * @note If the window is expanded, blanks are filled in; 411 If the window is contracted, text is clipped 412 * @see twCentredWin twMoveWin twGetWinPos 413 **/ 414 void __FASTCALL__ twResizeWin(TWindow *win,tAbsCoord width, tAbsCoord height); 415 416 /** Scrolls part of given window up. 417 * @param win handle of window to be scrolled 418 * @param ypos specifies vertical coordinate of line. All lines above it and line itself will be scrolled up 419 * @param npos specifies number of lines to be inserted. 420 * @return none 421 * @note If 0 is specified as npos, no lines are scrolled. 422 * @see twScrollWinDn twScrollWinLf twScrollWinRt 423 **/ 424 void __FASTCALL__ twScrollWinUp(TWindow *win,tRelCoord ypos, unsigned npos); 425 426 /** Scrolls part of given window down. 427 * @param win handle of window to be scrolled 428 * @param ypos specifies vertical coordinate of line. All lines below it and line itself will be scrolled down 429 * @param npos specifies number of lines to be inserted. 430 * @return none 431 * @note If 0 is specified as npos, no lines are scrolled. 432 * @see twScrollWinUp twScrollWinLf twScrollWinRt 433 **/ 434 void __FASTCALL__ twScrollWinDn(TWindow *win,tRelCoord ypos, unsigned npos); 435 436 /** Scrolls part of given window left. 437 * @param win handle of window to be scrolled 438 * @param xpos specifies horizontal coordinate of column. All columns most left it and column itself will be scrolled left 439 * @param npos specifies number of columns to be inserted. 440 * @return none 441 * @note If 0 is specified as npos, no columns are scrolled. 442 * @see twScrollWinUp twScrollWinDn twScrollWinRt 443 **/ 444 void __FASTCALL__ twScrollWinLf(TWindow *win,tRelCoord xpos, unsigned npos); 445 446 /** Scrolls part of given window right. 447 * @param win handle of window to be scrolled 448 * @param xpos specifies horizontal coordinate of column. All columns most right it and column itself will be scrolled right 449 * @param npos specifies number of columns to be inserted. 450 * @return none 451 * @note If 0 is specified as npos, no columns are scrolled. 452 * @see twScrollWinUp twScrollWinDn twScrollWinLf 453 **/ 454 void __FASTCALL__ twScrollWinRt(TWindow *win,tRelCoord xpos, unsigned npos); 455 456 /** Does centring of given window relatively other window or screen. 457 * @param it handle of window to be centred 458 * @param parent handle of centring window. 459 * @return none 460 * @note If \e parent is NULL, the window will 461 * be centred for screen 462 * @see twMoveWin twResizeWin twGetWinPos 463 **/ 464 void __FASTCALL__ twCentredWin(TWindow *it,const TWindow *parent); 465 466 /** Freezes redrawing of window. 467 * @param parent handle of centring window. 468 * @return none 469 * @note Freezed only redrawing of the window. 470 * All output will be produced, but 471 * screen will not be updated. 472 * @see twRefreshLine twRefreshPiece twRefreshWin twRefreshFullWin 473 **/ 474 void __FASTCALL__ twFreezeWin(TWindow *win); 475 476 /** Updates the line of screen by line of buffer of given window. 477 * @param win handle of refreshing window. 478 * @param y specify relative y coordinate of line to be refreshed. 479 * @return none 480 * @note If window is not freezed all output 481 * is automatically displayed on 482 * the screen. 483 * @see twFreezeWin twRefreshPiece twRefreshWin twRefreshFullWin 484 **/ 485 void __FASTCALL__ twRefreshLine(TWindow *win,tRelCoord y); 486 487 /** Updates the piece of screen line by piece of buffer of given window. 488 * @param win handle of refreshing window. 489 * @param stx,endx specify range of x coordinate of line to be refreshed. 490 * @param y specify relative y coordinate of line to be refreshed. 491 * @return none 492 * @note If window is not freezed all output 493 * is automatically displayed on 494 * the screen. 495 * @see twFreezeWin twRefreshLine twRefreshWin twRefreshFullWin 496 **/ 497 void __FASTCALL__ twRefreshPiece(TWindow *win,tRelCoord stx, tRelCoord endx,tRelCoord y); 498 499 /** Updates the screen buffer by client area of given window. 500 * @param win handle of refreshing window. 501 * @return none 502 * @note If window is not freezed all output 503 * is automatically displayed on 504 * the screen. 505 * @see twFreezeWin twRefreshLine twRefreshPiece twRefreshFullWin 506 **/ 507 void __FASTCALL__ twRefreshWin(TWindow *win); 508 509 /** Updates the screen buffer by buffer of given window entire. 510 * @param win handle of refreshing window. 511 * @return none 512 * @note If window is not freezed all output 513 * is automatically displayed on 514 * the screen. 515 * @see twFreezeWin twRefreshLine twRefreshPiece twRefreshWin 516 **/ 517 void __FASTCALL__ twRefreshFullWin(TWindow *win); 518 519 /** Returns pointer to the user data that stored in window. 520 * @param win handle of window. 521 * @return pointer to user data 522 * @note If no user data previously stored 523 * in window then NULL is returned. 524 * @see twSetUsrData 525 **/ 526 void * __FASTCALL__ twGetUsrData(TWindow *win); 527 528 /** Saves pointer to the user data in window. 529 * @param win handle of window. 530 * @param data pointer to the user data to be stored. 531 * @return pointer to user data that previously stored in window 532 * @note Pointer to previously stored user 533 * data is overwrited. 534 * @see twGetUsrData 535 **/ 536 void * __FASTCALL__ twSetUsrData(TWindow *win,void *data); 537 538 /** Returns screen position of window. 539 * @param win handle of window. 540 * @param x1_,y1_,x2_,y2_ pointers to coordinates where will be saved window position. 541 * @return none 542 * @see twMoveWin twResizeWin twCentredWin twGetWinAtPos 543 **/ 544 void __FASTCALL__ twGetWinPos(TWindow *win,tAbsCoord *x1_,tAbsCoord *y1_,tAbsCoord *x2_,tAbsCoord *y2_); 545 546 /** Returns width of window. 547 * @param win handle of window. 548 * @return width of window 549 * @see twGetWinHeight twGetClientHeight twGetClientWidth 550 **/ 551 unsigned __FASTCALL__ twGetWinWidth(TWindow *win); 552 553 /** Returns width of height. 554 * @param win handle of window. 555 * @return height of window 556 * @see twGetWinWidth twGetClientHeight twGetClientWidth 557 **/ 558 unsigned __FASTCALL__ twGetWinHeight(TWindow *win); 559 560 /** Returns width of window which is available for output. 561 * @param win handle of window. 562 * @return width of window which is available for output 563 * @see twGetWinWidth twGetWinHeight twGetClientHeight 564 **/ 565 unsigned __FASTCALL__ twGetClientWidth(TWindow *win); 566 567 /** Returns height of window which is available for output. 568 * @param win handle of window. 569 * @return height of window which is available for output 570 * @see twGetWinWidth twGetWinHeight twGetClientWidth 571 **/ 572 unsigned __FASTCALL__ twGetClientHeight(TWindow *win); 573 574 /** Returns handle of the window currently displayed at the absolute position x and y. 575 * @param x,y specify coordinates of the location. 576 * @return Handle for the window displayed at the 577 * specified position if a window is 578 * displayed. If no window is displayed 579 * at the this position, NULL is returned. 580 * @see twGetWinPos 581 **/ 582 TWindow * __FASTCALL__ twGetWinAtPos(tAbsCoord x, tAbsCoord y); 583 584 /** Checks visibility of window piece. 585 * @param x,y specify coordinates of the location. 586 * @return True if specified window is visible 587 * in specified location (Is not obscured). 588 * @see twGetWinPos 589 **/ 590 tBool __FASTCALL__ twIsPieceVisible(TWindow *win,tRelCoord x, tRelCoord y); 591 592 /** Converts window-relative coordinates to absolute screen coordinates 593 * @param win handle of window 594 * @param x,y specify the relative coordinates. 595 * @param xa,ya specify pointers to the absolute coordinates. 596 * @return none 597 * @see twCvtScreenCoord 598 **/ 599 void __FASTCALL__ twCvtWinCoords(TWindow *win,tRelCoord x, tRelCoord y,tAbsCoord *xa,tAbsCoord *ya); 600 601 /** Converts screen-relative coordinates to relative window coordinates 602 * @param win handle of window 603 * @param x,y specify screen coordinates. 604 * @param xr,yr specify pointers to the relative coordinates. 605 * @return True if successful, False otherwise. 606 * @see twCvtWinCoord 607 **/ 608 tBool __FASTCALL__ twCvtScreenCoords(TWindow *win,tAbsCoord x, tAbsCoord y,tRelCoord *xr,tRelCoord *yr); 609 610 /** Clears the current window window with default filler. 611 * @return none 612 * @see twClearWinEx 613 **/ 614 void __FASTCALL__ twClearWin(void); 615 616 /** Clears the current window window with given filler. 617 * @param filler character for filling the window 618 * @return none 619 * @see twClearWin 620 **/ 621 void __FASTCALL__ twClearWinEx(unsigned char filler); 622 623 /** Clears the current window from current position to the end of line with default filler. 624 * @return none 625 * @see twClrEOLEx 626 **/ 627 void __FASTCALL__ twClrEOL(void); 628 629 /** Clears the current window from current position to the end of line with given filler. 630 * @param filler character for filling the window 631 * @return none 632 * @see twClrEOL 633 **/ 634 void __FASTCALL__ twClrEOLEx(unsigned char filler); 635 636 /** Sets logical foreground and background colors of the text. 637 * @param fore,back specify colors to be set. 638 * @return Previously set color attributes 639 * @note The function affects only those 640 * characters output after the call to 641 * foreground and background; the function 642 * does not affect characters that are 643 * already displayed. 644 * @see twSetColorAttr twGetColor twGetColorAttr twTextColor twTextBkGnd 645 **/ 646 ColorAttr __FASTCALL__ twSetColor(Color fore,Color back); 647 648 /** Sets physical color attributes of the text. 649 * @param attr specifies color attributes. 650 * @return Previously set color attributes 651 * @note The function affects only those 652 * characters output after the call to 653 * foreground and background; the function 654 * does not affect characters that are 655 * already displayed. 656 * @see twSetColor twGetColor twGetColorAttr twTextColor twTextBkGnd 657 **/ 658 ColorAttr __FASTCALL__ twSetColorAttr(ColorAttr attr); 659 660 /** Returns logical foreground and background colors of the text. 661 * @param fore,back specify pointers to memory where will be saved logical background and foreground of the text. 662 * @return none 663 * @see twSetColorAttr twSetColor twGetColorAttr twTextColor twTextBkGnd 664 **/ 665 void __FASTCALL__ twGetColor(Color *fore, Color *back ); 666 667 /** Returns physical color attributes of the text. 668 * @return physical attributes of the text 669 * @see twSetColorAttr twSetColor twGetColor twTextColor twTextBkGnd 670 **/ 671 ColorAttr __FASTCALL__ twGetColorAttr( void ); 672 673 /** Sets logical foreground color of the text. 674 * @param col specifies color to be set. 675 * @return Previously set foreground color 676 * @note The function affects only those 677 * characters output after the call to 678 * foreground; the function does not 679 * affect characters that are already 680 * displayed. 681 * @see twSetColorAttr twSetColor twGetColor twTextBkGnd 682 **/ 683 Color __FASTCALL__ twTextColor( Color col ); 684 685 /** Sets logical background color of the text. 686 * @param col specifies color to be set. 687 * @return Previously set background color 688 * @note The function affects only those 689 * characters output after the call to 690 * background; the function does not 691 * affect characters that are already 692 * displayed. 693 * @see twSetColorAttr twSetColor twGetColor twTextColor 694 **/ 695 Color __FASTCALL__ twTextBkGnd( Color col ); 696 697 /** Returns frame and frame attributes of given window. 698 * @param win handle of window. 699 * @param frame pointer to memory area (8-byte length) where will be stored frame. 700 * @param fore,back pointers to memory area where will be stored logical colors of frame. 701 * @return none 702 * @see twGetFrameAttr twSetFrame twSetFrameAttr 703 * twGetTitle twGetTitleAttr twSetTitle twSetTitleAttr 704 * twGetFooter twGetFooterAttr twSetFooter twSetFooterAttr 705 **/ 706 void __FASTCALL__ twGetFrame(TWindow *win,char *frame,Color* fore,Color* back); 707 708 /** Returns title and title attributes of given window. 709 * @param win handle of window. 710 * @param title pointer to memory area where will be stored title. 711 * @param cb_title size of memory area where will be stored title. 712 * @param fore,back pointers to memory area where will be stored logical colors of title. 713 * @return alignment mode of title 714 * @see twGetFrame twGetFrameAttr twSetFrame twSetFrameAttr twGetFrame 715 * twGetTitleAttr twSetTitle twSetTitleAttr 716 * twGetFooter twGetFooterAttr twSetFooter twSetFooterAttr 717 **/ 718 tTitleMode __FASTCALL__ twGetTitle(TWindow *win,char* title,unsigned cb_title,Color* fore,Color* back); 719 720 /** Returns footer and footer attributes of given window. 721 * @param win handle of window. 722 * @param footer pointer to memory area where will be stored footer. 723 * @param cb_footer size of memory area where will be stored footer. 724 * @param fore,back pointers to memory area where will be stored logical colors of footer. 725 * @return alignment mode of footer 726 * @see twGetFrame twGetFrameAttr twSetFrame twSetFrameAttr 727 * twGetTitle twGetTitleAttr twSetTitle twSetTitleAttr 728 * twGetFooterAttr twSetFooter twSetFooterAttr 729 **/ 730 tTitleMode __FASTCALL__ twGetFooter(TWindow *win,char* footer,unsigned cb_footer,Color* fore,Color* back); 731 732 /** Returns frame and frame attributes of given window. 733 * @param win handle of window. 734 * @param frame pointer to memory area (8-byte length) where will be stored frame. 735 * @param attr pointer to memory area where will be stored physical color attributes of frame. 736 * @return none 737 * @see twGetFrame twSetFrame twSetFrameAttr 738 * twGetTitle twGetTitleAttr twSetTitle twSetTitleAttr 739 * twGetFooter twGetFooterAttr twSetFooter twSetFooterAttr 740 **/ 741 void __FASTCALL__ twGetFrameAttr(TWindow *win,char *frame,ColorAttr* attr); 742 743 /** Returns title and title attributes of given window. 744 * @param win handle of window. 745 * @param title pointer to memory area where will be stored title. 746 * @param cb_title size of memory area where will be stored title. 747 * @param attr pointers to memory area where will be stored physical color attributes of title. 748 * @return alignment mode of title 749 * @see twGetFrame twGetFrameAttr twSetFrame twSetFrameAttr twGetFrame 750 * twGetTitle twSetTitle twSetTitleAttr 751 * twGetFooter twGetFooterAttr twSetFooter twSetFooterAttr 752 **/ 753 tTitleMode __FASTCALL__ twGetTitleAttr(TWindow *win,char* title,unsigned cb_title,ColorAttr* attr); 754 755 /** Returns footer and footer attributes of given window. 756 * @param win handle of window. 757 * @param footer pointer to memory area where will be stored footer. 758 * @param cb_footer size of memory area where will be stored footer. 759 * @param fore,back pointers to memory area where will be stored physical color attributes of footer. 760 * @return alignment mode of footer 761 * @see twGetFrame twGetFrameAttr twSetFrame twSetFrameAttr 762 * twGetTitle twGetTitleAttr twSetTitle twSetTitleAttr 763 * twGetFooter twSetFooter twSetFooterAttr 764 **/ 765 tTitleMode __FASTCALL__ twGetFooterAttr(TWindow *win,char* footer,unsigned cb_footer,ColorAttr* attr); 766 767 /** Changes frame around given window with specified logical color attributes. 768 * @param win handle of window 769 * @param frame specifies new frame (8-byte length) 770 * @param fore,back specify new background and foreground colors 771 * @return none 772 * @see twGetFrame twGetFrameAttr twGetFooterAttr twSetFrameAttr 773 * twGetTitle twGetTitleAttr twSetTitle twSetTitleAttr 774 * twGetFooter twSetFooter twSetFooterAttr 775 **/ 776 void __FASTCALL__ twSetFrame(TWindow *win,const char *frame,Color fore,Color back); 777 778 /** Updates window title with specified logical color attributes. 779 * @param win handle of window 780 * @param title specifies new title 781 * @param titlemode specifies new title mode 782 * @param fore,back specify new background and foreground colors 783 * @return none 784 * @see twGetFrame twGetFrameAttr twGetFooterAttr twSetFrameAttr 785 * twGetTitle twGetTitleAttr twSetFrame twSetTitleAttr 786 * twGetFooter twSetFooter twSetFooterAttr 787 **/ 788 void __FASTCALL__ twSetTitle(TWindow *win,const char* title,tTitleMode titlemode,Color fore,Color back); 789 790 /** Updates window footer with specified logical color attributes. 791 * @param win handle of window 792 * @param footer specifies new footer 793 * @param footermode specifies new footer mode 794 * @param fore,back specify new background and foreground colors 795 * @return none 796 * @see twGetFrame twGetFrameAttr twGetFooterAttr twSetFrameAttr 797 * twGetTitle twGetTitleAttr twSetFrame twSetTitleAttr 798 * twGetFooter twSetTitle twSetFooterAttr 799 **/ 800 void __FASTCALL__ twSetFooter(TWindow *win,const char* footer,tTitleMode footermode,Color fore,Color back); 801 802 /** Changes frame around given window with specified physical color attributes. 803 * @param win handle of window 804 * @param frame specifies new frame (8-byte length) 805 * @param attr specifies new color attributes 806 * @return none 807 * @see twGetFrame twGetFrameAttr twGetFooterAttr twSetFrame 808 * twGetTitle twGetTitleAttr twSetTitle twSetTitleAttr 809 * twGetFooter twSetFooter twSetFooterAttr 810 **/ 811 void __FASTCALL__ twSetFrameAttr(TWindow *win,const char *frame,ColorAttr attr); 812 813 /** Updates window title with specified physical color attributes. 814 * @param win handle of window 815 * @param title specifies new title 816 * @param titlemode specifies new title mode 817 * @param attr specifies new color attributes 818 * @return none 819 * @see twGetFrame twGetFrameAttr twGetFooterAttr twSetFrameAttr 820 * twGetTitle twGetTitleAttr twSetFrame twSetTitle 821 * twGetFooter twSetFooter twSetFooterAttr 822 **/ 823 void __FASTCALL__ twSetTitleAttr(TWindow *win,const char* title,tTitleMode titlemode,ColorAttr attr); 824 825 /** Updates window footer with specified physical color attributes. 826 * @param win handle of window 827 * @param footer specifies new footer 828 * @param footermode specifies new footer mode 829 * @param attr specifies new logical color attributes 830 * @return none 831 * @see twGetFrame twGetFrameAttr twGetFooterAttr twSetFrameAttr 832 * twGetTitle twGetTitleAttr twSetFrame twSetTitleAttr 833 * twGetFooter twSetTitle twSetFooter 834 **/ 835 void __FASTCALL__ twSetFooterAttr(TWindow *win,const char* footer,tTitleMode footermode,ColorAttr attr); 836 837 #define TW_CUR_OFF 0 /**< Defines that cursor in invisible state */ 838 #define TW_CUR_NORM 1 /**< Defines that cursor in normal state (filles 20% of the character cell) */ 839 #define TW_CUR_SOLID 2 /**< Defines that cursor in solid state (filles 100% of the character cell) */ 840 841 /** Sets the size and visibility of the cursor 842 * @param type indicates type of cursor 843 * @return none 844 * @note The cursor in particular window is 845 * visible only when the type of cursor 846 * is normal or solid and window is 847 * visible and has focus. Main difference 848 * between twSetCursorType and __vioSetCursorType 849 * is rememberring of cursor type and caching 850 * every call to the OS. 851 * @see twGetCursorType 852 **/ 853 void __FASTCALL__ twSetCursorType(int type); 854 855 /** Retrieves information about the size and visibility of the cursor 856 * @param none 857 * @return Current type of the cursor 858 * @note Main difference between twGetCursorType 859 * and __vioGetCursorType is rememberring 860 * of cursor type and caching every call 861 * to the OS. 862 * @see twSetCursorType 863 **/ 864 int __FASTCALL__ twGetCursorType( void ); 865 866 /** Sets the cursor coordiantes relative to the used window 867 * @param x,y specify horizontal and vertical coordinates for the location 868 * @return none 869 * @note If X or Y are outside the window frame, 870 * they will be clipped. 871 * @see twWhereX twWhereY 872 **/ 873 void __FASTCALL__ twGotoXY(tRelCoord x,tRelCoord y); 874 875 /** Returns the x coordinate of the current cursor position, within currently used window. 876 * @return none 877 * @note If X or Y are outside the window frame, 878 * they will be clipped. 879 * @see twWhereX twWhereY 880 **/ 881 tRelCoord __FASTCALL__ twWhereX( void ); 882 883 /** Returns the y coordinate of the current cursor position, within currently used window. 884 * @return none 885 * @note If X or Y are outside the window frame, 886 * they will be clipped. 887 * @see twWhereX twWhereY 888 **/ 889 tRelCoord __FASTCALL__ twWhereY( void ); 890 891 /** Outputs the character to the active window at current cursor position. 892 * @param ch character to be written 893 * @return none 894 * @see twGetChar twPutS twPrintF twDirectWrite twWriteBuffer 895 **/ 896 void __FASTCALL__ twPutChar(char ch); 897 898 /** Reads the character from the active window at current cursor position. 899 * @return character read 900 * @note there is no error return value. 901 * @see twPutChar twPutS twPrintF twDirectWrite twWriteBuffer twReadBuffer 902 **/ 903 char __FASTCALL__ twGetChar( void ); 904 905 /** Writes the null-terminated string to the active window at current cursor position. 906 * @param str null-terminated string to be written 907 * @return number of really written characters 908 * @note Function has special reaction on carriage 909 * return and linefeed characters. If such 910 * characters occured, then cursor position 911 * will be changed automatically. 912 * Character '\n' changes both x and y 913 * cursor coordinates (for unix compatibility) 914 * as x=1 and y++ 915 * Character '\r' changes only x coordinate 916 * as x=1. 917 * If written text is large than window, then 918 * it will be clipped. 919 * @see twGetChar twPutChar twPrintF twDirectWrite twWriteBuffer 920 **/ 921 int __FASTCALL__ twPutS(const char *str); 922 923 /** Writes buffer directly to the active window at specified location. 924 * @param x,y specify location of output 925 * @param buff specifies buffer to be written 926 * @param len specifies length of buffer 927 * @return number of really written characters 928 * @note Function writes all characters as is, 929 * without checking for carriage return and 930 * linefeed. 931 * If written text is large than window, then 932 * it will be clipped. 933 * @see twGetChar twPutChar twPrintF twPutS twWriteBuffer 934 **/ 935 int __FASTCALL__ twDirectWrite(tRelCoord x,tRelCoord y,const void *buff,unsigned len); 936 937 /** Provides formatted output directly to the active window at current cursor position. 938 * @param fmt specifies formatted string 939 * @return number of really written characters 940 * @note Function has same input format as 941 * standard *printf function family. 942 * Functiom has same reaction on carriage 943 * return and linefeed as \e twPutS. 944 * If written text is large than window, then 945 * it will be clipped. 946 * @bug Program is destroyed, when final output 947 * is greated than size of console or terminal 948 * screen. I.e. greated than tvioWidth*tvioHeight 949 * @see twGetChar twPutChar twDirectWrite twPutS twWriteBuffer 950 **/ 951 int __FASTCALL__ twPrintF(const char *fmt,...); 952 953 /** Accesses to the active window directly, writing a single line. 954 * @param win handle of window 955 * @param x,y specify location of output 956 * @param buff pointer to virtual video buffer to be written 957 * @param len specifies length of virtual video buffer 958 * @return none 959 * @note Function writes specified number of 960 * characters and attributes to window, 961 * beginning at specified location. 962 * If written output is large than window, 963 * then it will be clipped. 964 * @see twGetChar twPutChar twDirectWrite twPutS twReadBuffer 965 **/ 966 void __FASTCALL__ twWriteBuffer(TWindow *win,tRelCoord x,tRelCoord y,const tvioBuff *buff,unsigned len); 967 968 /** Accesses to the active window directly, reading a single line. 969 * @param win handle of window 970 * @param x,y specify location of input 971 * @param buff pointer to location at which readed material will be stored. 972 * @param len specifies length of location 973 * @return none 974 * @note Function reads specified number of 975 * characters and attributes from window, 976 * beginning at specified location. 977 * @see twGetChar twPutChar twDirectWrite twPutS twWriteBuffer 978 **/ 979 void __FASTCALL__ twReadBuffer(TWindow *win,tRelCoord x,tRelCoord y,tvioBuff *buff,unsigned len); 980 981 /** Remaps logical color with new physical value. 982 * @param color lopical color to be remapped 983 * @param value specifies new physical value of logical color 984 * @return none 985 * @see twGetRemappedColor 986 **/ 987 void __FASTCALL__ twRemapColor(Color color,unsigned char value); 988 989 /** Returns physical value of logical color. 990 * @param color lopical color value 991 * @param value specifies new physical value of logical color 992 * @return physical value of logical color 993 * @see twRemapColor 994 **/ 995 unsigned char __FASTCALL__ twGetMappedColor(Color color); 996 997 #ifdef __cplusplus 998 } 999 #endif 1000 1001 #include "biewlib/tw_class.h" 1002 1003 #endif 1004 1005 1006 1007 1008 1009 1010