1 /* coolwidget.h - main header file 2 Copyright (C) 1996-2017 Paul Sheer 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 17 02111-1307, USA. 18 */ 19 20 #ifndef COOL_WIDGET_H 21 #define COOL_WIDGET_H 22 23 #include <config.h> 24 #include <stdio.h> 25 #include <my_string.h> 26 #include <stdlib.h> 27 #include <stdarg.h> 28 #include <ctype.h> 29 #include <locale.h> 30 31 #include "gettext.h" 32 33 #include <errno.h> 34 #ifdef HAVE_SYS_ERRNO_H 35 #include <sys/errno.h> 36 #endif 37 38 #if TIME_WITH_SYS_TIME 39 # include <sys/time.h> 40 # include <time.h> 41 #else 42 # if HAVE_SYS_TIME_H 43 # include <sys/time.h> 44 # else 45 # include <time.h> 46 # endif 47 #endif 48 #include <sys/types.h> 49 #ifdef HAVE_UNISTD_H 50 # include <unistd.h> 51 #endif 52 53 #ifdef HAVE_SYS_SELECT_H 54 # include <sys/select.h> 55 #endif 56 57 #if HAVE_DIRENT_H 58 #include <dirent.h> 59 #define NAMLEN(dirent) strlen((dirent)->d_name) 60 #else 61 #define dirent direct 62 #define NAMLEN(dirent) (dirent)->d_namlen 63 #if HAVE_SYS_NDIR_H 64 #include <sys/ndir.h> 65 #endif 66 #if HAVE_SYS_DIR_H 67 #include <sys/dir.h> 68 #endif 69 #if HAVE_NDIR_H 70 #include <ndir.h> 71 #endif 72 #endif 73 74 #include <sys/stat.h> 75 76 #ifdef HAVE_UNISTD_H 77 #include <unistd.h> 78 #endif 79 80 #include <X11/Intrinsic.h> 81 #include "global.h" 82 #include "vgagl.h" 83 #include "lkeysym.h" 84 85 #include "stringtools.h" 86 #include "app_glob.c" 87 #include "drawings.h" 88 #include "3dkit.h" 89 #include "xdnd.h" 90 #include "mousemark.h" 91 #include "font.h" 92 93 #define ALRM_PER_SECOND 50 94 #define NICE_FILENAME_CHARS "+-.0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~" 95 96 typedef struct initialisation { 97 char *name, *display, *geometry, *font, *widget_font, *bg; 98 char *fg_red, *fg_green, *fg_blue; /* string doubles */ 99 #define CINIT_OPTION_USE_GREY 1 100 #define CINIT_OPTION_VERBOSE 2 101 #define CINIT_OPTION_WAIT_FOR_DISPLAY 4 102 unsigned long options; 103 char *look; 104 } CInitData; 105 106 107 #define CEdit WEdit 108 109 /* edit this */ 110 /* #define u_32bit_t unsigned long */ 111 #define u_32bit_t unsigned int 112 #define word unsigned short 113 #define byte unsigned char 114 115 #define WIDGET_MAGIC_BEGIN 0x6e065f4d 116 #define WIDGET_MAGIC_END 0x54f560e9 117 118 #define TEXT_SET_COLUMN 1 119 #define TEXT_SET_LINE 2 120 #define TEXT_SET_POS 3 121 #define TEXT_SET_CURSOR_LINE 4 122 123 /* These are all the widget kinds (the kind member of the widget structure) */ 124 enum { \ 125 C_NOT_A_WIDGET, C_BUTTON_WIDGET, C_WINDOW_WIDGET, C_BAR_WIDGET, C_SUNKEN_WIDGET, \ 126 C_VERTSCROLL_WIDGET, C_HORISCROLL_WIDGET, C_HORSCROLL_WIDGET, C_TEXTINPUT_WIDGET, \ 127 C_TEXTBOX_WIDGET, C_TEXT_WIDGET, C_BWIMAGE_WIDGET, C_SPREAD_WIDGET, \ 128 C_PROGRESS_WIDGET, C_BITMAP_WIDGET, C_BITMAPBUTTON_WIDGET, C_SWITCH_WIDGET, \ 129 C_8BITIMAGE_WIDGET, C_THREED_WIDGET, C_PICTURE_WIDGET, C_EDITOR_WIDGET, \ 130 C_MENU_WIDGET, C_MENU_BUTTON_WIDGET, C_ALARM_WIDGET, C_FIELDED_TEXTBOX_WIDGET, \ 131 C_TOOLHINT_WIDGET, C_ICON_WIDGET, C_STATUS_WIDGET, C_RXVT_WIDGET, C_UNICODE_WIDGET 132 }; 133 134 /* the user can start creating his widgets from 100: */ 135 #define C_LAST_WIDGET 100 136 137 #define Button12345Mask (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) 138 139 /* 140 Here are some addition events that you may recieve or send using 141 CNextEvent instead of XNextEvent. (LASTEvent = 35) 142 */ 143 /* this comes every 1/CGetCursorBlinkRate() of a second */ 144 #define AlarmEvent (LASTEvent + 1) 145 /* This you won't recieve --- it is used for joining small expose regions together */ 146 #define InternalExpose (LASTEvent + 2) 147 /* Send this event to the editor to force the editor widget to execute a command */ 148 #define EditorCommand (LASTEvent + 3) 149 /* Comes every 1/ALRM_PER_SECOND of a second (see initapp.c for correct amount) */ 150 #define TickEvent (LASTEvent + 4) 151 /* a button repeat event happens when a mouse button is pressed and held down */ 152 #define ButtonRepeat (LASTEvent + 5) 153 /* When you recieve this it is because the window manager wants the app to 154 quit. You would recieve this when the user has pressed on the main window. */ 155 #define QuitApplication (LASTEvent + 6) 156 #define CLASTEvent (LASTEvent + 7) 157 158 /* Library is limited to this number of widgets at once */ 159 #define MAX_NUMBER_OF_WIDGETS 1024 160 161 /* one of the (long int) "CoolBlue" colors (0-15) that make up the windows, buttons etc */ 162 #define color_widget(i) color_pixels[i] 163 /* one of a 3x3x3 (RxGxB) color palette. eg R=2, G=1, B=0 is color_palette(19). */ 164 #define color_palette(i) color_pixels[(i) + 16] 165 /* 0-64 grey levels (not supprted unless specified in config.h) */ 166 #define color_grey(i) color_pixels[(i) + 43] 167 168 int allocate_color (char *color); 169 170 /* draw a line in the window d */ 171 #define CLine(d, x, y, w, h) XDrawLine(CDisplay, d, CGC, x, y, w, h) 172 /* rectangle */ 173 #define CRectangle(d, x, y, w, h) XFillRectangle(CDisplay, d, CGC, x, y, w, h) 174 /* rectangle */ 175 #define CBox(d, x, y, w, h) XDrawRectangle(CDisplay, d, CGC, x, y, w, h) 176 /* set the foreground color */ 177 #define CSetColor(c) XSetForeground(CDisplay, CGC, c) 178 /* set the background color */ 179 #define CSetBackgroundColor(c) XSetBackground(CDisplay, CGC, c) 180 /* width of text in pixels in the current font */ 181 int CImageTextWidth (const char *s, int l); 182 /* width of a string in pixels in the current font Wide Character */ 183 int CImageTextWidthWC (XChar2b * s, wchar_t * swc, int l); 184 /* width of a string in pixels in the current font */ 185 int CImageStringWidth (const char *s); 186 /* draw image string */ 187 int CImageString (Window w, int x, int y, const char *s); 188 /* draw image text */ 189 int CImageText (Window w, int x, int y, const char *s, int l); 190 /* draw image string Wide Character - supply both wc and normal string formats */ 191 int CImageTextWC (Window w, int x, int y, XChar2b * s, wchar_t * swc, int l); 192 193 194 unsigned char *wcrtomb_ucs4_to_utf8 (wchar_t c); 195 196 #define SCREEN_ASPECT_RATIO 1.333 197 198 /* some standard colors */ 199 /* the color of the "flat" of a window */ 200 #define COLOR_FLAT ((*look->get_button_flat_color) ()) 201 202 /* used for NeXTish drawings */ 203 #define COLOR_DARK color_widget(5) 204 #define COLOR_LIGHT color_widget(8) 205 206 #define COLOR_WHITE color_widget(15) 207 #define COLOR_BLACK color_widget(0) 208 209 /* SelectInput for various types of widgets */ 210 #define INPUT_EXPOSE (KeyPressMask | KeyReleaseMask | ExposureMask | \ 211 StructureNotifyMask | VisibilityChangeMask | \ 212 LeaveWindowMask | EnterWindowMask | PointerMotionMask) 213 #define INPUT_KEY (ExposureMask | ButtonPressMask | ButtonReleaseMask | \ 214 KeyPressMask | KeyReleaseMask | ButtonMotionMask | \ 215 StructureNotifyMask | PropertyChangeMask | \ 216 LeaveWindowMask | EnterWindowMask | PointerMotionMask) 217 #define INPUT_MOTION INPUT_KEY 218 #define INPUT_BUTTON (INPUT_KEY | KeyReleaseMask) 219 220 /* internal */ 221 #define WINDOW_MAPPED 1 222 #define WINDOW_FOCUS_WHEN_MAPPED 2 223 224 /* menu callback function */ 225 typedef void (*callfn) (unsigned long data); 226 227 struct menu_item { 228 char *text; 229 char hot_key; 230 callfn call_back; 231 unsigned long data; /* data for user. it is passed to callfn */ 232 }; 233 234 #define MENU_ITEM_BASIC(text,hot_key,callback,data) \ 235 text, hot_key, callback, data 236 237 /* not supported 238 #define MENU_ITEM_OPTION(text,hot_key,option) \ 239 text, hotkey, (callfn) 1, (int *) option 240 #define MENU_ITEM_SECOND_LEVEL(text,hotkey,menuitems) \ 241 text, hotkey, (callfn) 2, (struct menu_item *) menuitems 242 */ 243 244 #define ClassOfVisual(v) ((v)->class) 245 246 /* spacing between widgets in pixels */ 247 #define WIDGET_SPACING option_interwidget_spacing 248 #define WIDGET_FOCUS_RING ((*look->get_focus_ring_size) ()) 249 #define WINDOW_EXTRA_SPACING ((*look->get_extra_window_spacing) ()) 250 251 /* spacing between the bevel and the text of the text widget */ 252 #define TEXT_RELIEF 3 253 254 /* don't change this without adjusting white fill in inputwidget.c */ 255 #define TEXTINPUT_RELIEF 1 256 #define BUTTON_RELIEF 2 257 258 /* auto widget sizing (use instead of width or height to work out the width 259 of widgets that have text in them) */ 260 #define AUTO_WIDTH -32000 261 #define AUTO_HEIGHT -32001 262 #define AUTO_SIZE AUTO_WIDTH, AUTO_HEIGHT 263 264 #define TEXTINPUT_LAST_INPUT ((char *) 1) 265 266 /* font offsets for drawing */ 267 #define FONT_OFFSET_X 0 268 269 #define EDIT_FRAME_W 7 270 #define EDIT_FRAME_H 7 271 272 /* if this gets changed, the cursor rendering (upside down "L") in editdraw and 273 cooledit.c must be adjusted so that the cursor is erased properly */ 274 #define FONT_OFFSET_Y FONT_BASE_LINE 275 276 277 /* 278 A reduced event. This structure is returned by CNextEvent, and 279 contains most of the things you may need. Anything more is contained 280 in XEvent. 281 */ 282 typedef struct { 283 /* widget's identification string */ 284 char *ident; 285 int i; 286 287 /* data */ 288 int x; 289 int y; 290 int xt; 291 int yt; 292 293 Window window; 294 295 /* enumerated above */ 296 int kind; 297 int type; 298 299 /* if a key was pressed, this is the KeySym */ 300 int key; 301 char xlat[8]; /* translation */ 302 long insert; 303 Time time; 304 unsigned int button; 305 306 /* 1 for a double click */ 307 int double_click; 308 unsigned int state; 309 310 /* if text was returned by the event */ 311 char *text; 312 313 /* if the event was already handled by a callback routine */ 314 char handled; 315 316 /* if the event coused an editor command */ 317 int command; /* editor commands */ 318 } CEvent; 319 320 321 /* This is the structure of a widget. It is presently 232 bytes 322 long. With 100 widgets on at once, this is only 23k, so the 323 inefficiency in having only one structure is justified. */ 324 struct cool_widget { 325 char ident[33]; /*unique identifying string given by user */ 326 /* for debugging */ 327 u_32bit_t magic_begin; 328 329 /* essentials */ 330 Window winid; /* X integer window id of widget */ 331 Window parentid; /* parent window of window */ 332 Window mainid; /* main window of window */ 333 int (*eh) (struct cool_widget *, XEvent *, CEvent *); /* internal event handler */ 334 int (*callback_before) (struct cool_widget *, XEvent *, CEvent *); /* user event handler called before internal handler */ 335 int (*callback) (struct cool_widget *, XEvent *, CEvent *); /* user event handler */ 336 void (*destroy) (struct cool_widget *); /*only a few widgets need special distruction */ 337 void (*resize) (int, int, int, int, int *, int *, int *, int *); /* when the parent is resized, 338 the new size and position are 339 returned by this function */ 340 void (*render) (struct cool_widget *w); 341 char ** (*get_line) (void *data, int line_number, int *num_fields, int *tagged); /* returns a text box line */ 342 343 /* void resize ( 344 * old_parent_w, old_parent_h, 345 * new_parent_w, new_parent_h, 346 * int *new_this_widget_x, int *new_this_widget_y, 347 * int *new_this_widget_w, int *new_this_widget_h 348 * ); 349 */ 350 void (*scroll_bar_link) (struct cool_widget *, struct cool_widget *, XEvent *, CEvent *, int); 351 void (*scroll_bar_extra_render) (struct cool_widget *); 352 /* 353 * void scroll_bar_link (scrollbar, widget, xevent, cwevent, which_button_1_to_5); 354 */ 355 /* basics */ 356 int width, height; /* of window --- just to save looking it up */ 357 int x, y; /* position in parent --- top left corner */ 358 int kind; /* one of C??????_WIDGET above */ 359 char disabled; /* displayed, but not functioning */ 360 char takes_focus; /* can this widget take input focus? */ 361 char mapped; /* has window yet been mapped */ 362 char nothing; /* pad */ 363 364 /* data */ 365 char *label; /* text that gets drawn into button */ 366 char *graphic; /* Possibly a bitmap to go onto the button */ 367 int *tab; /* columns for spreadsheat widget */ 368 char *text; /* text goes into textbox textinput and text widgets */ 369 char *headings; /* headings of spreadsheet columns */ 370 GraphicsContext *gl_graphicscontext; /*for svgalib image widgets */ 371 XImage *ximage; /* for X images picture widgets */ 372 Pixmap pixmap; /* for pixmaps */ 373 CPicture *pic; /* for lines, circles, rects and arcs. */ 374 TD_Solid *solid; 375 char *toolhint; /* hints for buttons */ 376 struct editor_widget *editor; 377 struct menu_item *menu; 378 379 /* Positions. What they are used for depends on the kind of widget. See coolwidget.c for an explanation */ 380 long cursor; 381 long column; 382 long numlines; 383 long firstline; 384 long current; 385 long firstcolumn; 386 long textlength; 387 long mark1, mark2; 388 long search_start; 389 int search_len; 390 Window last_child_focussed; /* This is for main windows. It records 391 the last child within this main window 392 that has the focus. If the window 393 manager switches focus to another 394 window, then when focus is switch back, 395 this will have kept the correct child to 396 recieve focus. */ 397 398 /* settings */ 399 unsigned long options; 400 #define BUTTON_HIGHLIGHT (1<<1) 401 #define BUTTON_PRESSED (1<<2) 402 403 #define MENU_AUTO_PULL_UP (1<<3) 404 405 #define EDITOR_NO_FILE (1<<3) 406 #define EDITOR_NO_SCROLL (1<<4) 407 #define EDITOR_NO_TEXT (1<<5) 408 #define EDITOR_HORIZ_SCROLL (1<<6) 409 410 #define FILELIST_LAST_ENTRY (1<<8) 411 #define FILELIST_TAGGED_ENTRY (1<<9) 412 /* default is sort by name */ 413 #define FILELIST_SORT_UNSORTED (1<<10) 414 #define FILELIST_SORT_EXTENSIONS (1<<11) 415 #define FILELIST_SORT_SIZE (1<<12) 416 #define FILELIST_SORT_MDATE (1<<13) 417 #define FILELIST_SORT_CDATE (1<<14) 418 #define FILELIST_FILES_ONLY (1<<15) 419 #define FILELIST_DIRECTORIES_ONLY (1<<16) 420 #define FILELIST_ALL_FILES (FILELIST_DIRECTORIES_ONLY|FILELIST_FILES_ONLY) 421 422 /* these musn't be within the first 8 bits (see bitmapbutton.c) */ 423 #define RADIO_INVERT_GROUP (1<<8) 424 #define RADIO_ONE_ALWAYS_ON (1<<9) 425 #define SWITCH_PICTURE_TYPE (1<<10) 426 427 #define TEXTBOX_FILE_LIST (1<<1) 428 #define TEXTBOX_MAN_PAGE (1<<2) 429 #define TEXTBOX_MARK_WHOLE_LINES (1<<3) 430 #define TEXTBOX_NO_CURSOR (1<<4) 431 #define TEXTBOX_NO_KEYS (1<<5) 432 #define TEXTBOX_NO_STRDUP (1<<6) 433 #define TEXTBOX_WRAP (1<<7) 434 435 #define TEXTINPUT_PASSWORD (1<<3) 436 #define TEXTINPUT_NUMBERS (1<<4) 437 438 #define TEXT_CENTRED (1<<3) 439 440 #define WINDOW_HAS_HEADING (1<<1) 441 #define WINDOW_SIZE_HINTS_SET (1<<2) 442 #define WINDOW_USER_POSITION (1<<3) 443 #define WINDOW_USER_SIZE (1<<4) 444 #define WINDOW_NO_BORDER (1<<5) 445 446 /* must be higher than all other options */ 447 #define WIDGET_HOTKEY_ACTIVATES (1<<17) 448 #define WIDGET_TAKES_FOCUS_RING (1<<18) 449 #define WIDGET_TAKES_SELECTION (1<<19) 450 #define WIDGET_FREE_USER_ON_DESTROY (1<<20) 451 452 unsigned long position; 453 #define WINDOW_ALWAYS_RAISED (1<<0) /* remains on top when even after CRaise'ing other windows */ 454 #define WINDOW_ALWAYS_LOWERED (1<<1) /* remins on bottom */ 455 #define WINDOW_UNMOVEABLE (1<<2) /* cannot be moved by clicking on the window's background */ 456 #define WINDOW_RESIZABLE (1<<3) /* can be resized (has cosmetic in the lower right corner) */ 457 458 /* these tell the widgets behaviour on resizing its parent window */ 459 #define POSITION_RIGHT (1<<4) /* moves to follow the right border */ 460 #define POSITION_WIDTH (1<<5) /* resizes to follow the right border */ 461 #define POSITION_BOTTOM (1<<6) 462 #define POSITION_HEIGHT (1<<7) 463 #define POSITION_CENTRE (1<<8) /* centres from left to right */ 464 #define POSITION_FILL (1<<9) /* fills to right border */ 465 466 #define WINDOW_MAXIMISED (1<<10) 467 468 /* links to other widgets as needed */ 469 struct cool_widget *hori_scrollbar; 470 struct cool_widget *vert_scrollbar; 471 struct cool_widget *textbox; 472 struct cool_widget *textinput; 473 struct cool_widget *droppedmenu; 474 struct mouse_funcs *funcs; 475 476 char keypressed; /* has a key been pressed since this widgets creation (used for text input) */ 477 char resized; /* has the widget just been resized? you can check this before rendering, and then reset to 0 */ 478 unsigned short hotkey; /* sometimes used */ 479 480 unsigned long fg; /* colors */ 481 unsigned long bg; 482 483 /* used for internal widgets for additional data */ 484 void *hook; 485 486 /* user structure. you can put addition data that you might need in here */ 487 void *user; 488 void (*free_user) (void *); 489 XIC input_context; 490 void *rxvt; 491 Pixmap pixmap_mask; 492 char pad[228]; 493 494 /* for debugging */ 495 u_32bit_t magic_end; 496 }; 497 498 typedef struct cool_widget CWidget; 499 500 /* you may want to use these */ 501 #define CTextOf(w) ((w)->text) 502 #define CLabelOf(w) ((w)->label) 503 #define CUserOf(w) ((w)->user) 504 #define CHeightOf(w) ((w)->height) 505 #define CWidthOf(w) ((w)->width) 506 #define CXof(w) ((w)->x) 507 #define CYof(w) ((w)->y) 508 #define CWindowOf(w) ((w)->winid) 509 #define CParentOf(w) ((w)->parentid) 510 #define CIdentOf(w) ((w)->ident) 511 #define CWindowOf(w) ((w)->winid) 512 #define CHeightOf(w) ((w)->height) 513 #define CWidthOf(w) ((w)->width) 514 #define COptionsOf(w) ((w)->options) 515 516 /* internal */ 517 typedef struct disabled_state { 518 u_32bit_t state[(MAX_NUMBER_OF_WIDGETS + 31) / 32]; 519 u_32bit_t mask[(MAX_NUMBER_OF_WIDGETS + 31) / 32]; 520 } CState; 521 522 /* 523 The only global variables for the widgets. This is the actual array 524 of pointers that holds the malloced widget structures 525 */ 526 527 #ifdef COOL_WIDGET_C 528 int last_widget; /* gives length of widget list */ 529 CWidget *widget[MAX_NUMBER_OF_WIDGETS]; /* first widget is at 1 */ 530 #else 531 extern int last_widget; 532 extern CWidget *widget[MAX_NUMBER_OF_WIDGETS]; 533 #endif 534 535 /* CIndex(i) used to return a pointer to the widget i */ 536 #define CIndex(i) widget[i] 537 538 /* returns a pointer to the widget called ident or 0 if not found */ 539 CWidget *CIdent (const char *ident); 540 541 /* returns a pointer to the widget of window win */ 542 CWidget *CWidgetOfWindow (Window win); 543 544 /* Returns the widgets window or 0 if not found */ 545 Window CWindowOfWidget (const char *ident); 546 547 /* Returns the first parent, grandparent, etc, of the window that is of the C_WIDGET_WINDOW type */ 548 CWidget *CDialogOfWindow (Window window); 549 550 /* Returns top level window of the widget */ 551 CWidget *CMainOfWindow (Window window); 552 553 /* Initialise. Opens connection to the X display, processing -display -font, and -geom args 554 sets up GC's, visual's and so on */ 555 void CInitialise (CInitData * config); 556 557 /* returns non-zero if a child exitted */ 558 int CChildExitted (pid_t p, int *status); 559 560 /* Call when app is done. This undraws all widgets, free's all data 561 and closes the connection to the X display */ 562 void CShutdown (void); 563 564 /* Prints an error to stderr, or to a window if one can be created, then exits */ 565 void CError (const char *fmt,...); 566 567 /* fd watch for internal select */ 568 #define CAddWatch(fd, cb, how, data) _CAddWatch(__FILE__, __LINE__, fd, cb, how, data) 569 int _CAddWatch (char *file, int line, int fd, void (*callback) (int, fd_set *, fd_set *, fd_set *, void *), int how, void *data); 570 void CRemoveWatch (int fd, void (*callback) (int, fd_set *, fd_set *, fd_set *, void *), int how); 571 #define WATCH_READING (1<<0) 572 #define WATCH_WRITING (1<<1) 573 #define WATCH_ERROR (1<<2) 574 575 /* Normal malloc with check for 0 return */ 576 void *CMalloc (size_t size); 577 void *CDebugMalloc (size_t x, int line, const char *file); 578 579 /* get UTF-8 sequence from user selected glyph */ 580 unsigned char *CGetUnichar (Window in, char *heading); 581 582 /* Draw a panel onto which widgets will be drawn, this must not be a main window */ 583 Window CDrawDialog (const char *identifier, Window parent, int x, int y); 584 585 /* Draw a panel with a heading and a seperator line. The position below the 586 seperator line is recorded in h, start drawing in the window from there. */ 587 Window CDrawHeadedDialog (const char *identifier, Window parent, int x, int y, const char *label); 588 void CMapDialog (const char *ident); 589 590 #define CDrawMainWindow(a,b) CDrawHeadedDialog (a, CRoot, 0, 0, b) 591 void CSetBackgroundPixmap (const char *ident, const char *data[], int w, int h, char start_char); 592 593 void CSetWindowResizable (const char *ident, int min_width, int min_height, int max_width, int max_height); 594 595 /* returns the direct child of the root window */ 596 Window CGetWMWindow (Window win); 597 void CRaiseWMWindow (char *ident); 598 599 /* Draw a button */ 600 CWidget *CDrawButton (const char *identifier, Window parent, int x, int y, 601 int width, int height, const char *label); 602 603 /* Set tool hint for a widget */ 604 void CSetToolHint (const char *ident, const char *text); 605 606 /* Draw a button with a bitmap on it, (see dialog.c for example) */ 607 CWidget *CDrawBitmapButton (const char *identifier, Window parent, int x, int y, 608 int width, int height, unsigned long fg, unsigned long bg, const unsigned char data[]); 609 #define TICK_BUTTON_WIDTH 44 610 #define PIXMAP_BUTTON_TICK TICK_BUTTON_WIDTH, TICK_BUTTON_WIDTH, tick_bits, '0' 611 #define PIXMAP_BUTTON_SAVE TICK_BUTTON_WIDTH, TICK_BUTTON_WIDTH, save_pixmap, '0' 612 #define PIXMAP_BUTTON_CROSS TICK_BUTTON_WIDTH, TICK_BUTTON_WIDTH, cross_bits, '0' 613 #define PIXMAP_BUTTON_EXCLAMATION TICK_BUTTON_WIDTH, TICK_BUTTON_WIDTH, exclam_bits, '0' 614 615 CWidget *CDrawPixmapButton (const char *identifier, Window parent, 616 int x, int y, int width, int height, const char *data[], char start_char); 617 618 /* Draws a toggle switch, pass on as the default setting */ 619 CWidget *CDrawSwitch (const char *identifier, Window parent, int x, int y, int on, const char *label, int group); 620 621 /* Draw status line - like a single line text widget but interprets colours */ 622 CWidget *CDrawStatus (const char *identifier, Window parent, int x, int y, int w, char *str); 623 624 /* Draw a text input widget */ 625 CWidget *CDrawTextInput (const char *identifier, Window parent, int x, int y, 626 int width, int height, int maxlen, const char *string); 627 /* Adds a line of text to the history of a text input. */ 628 void CAddToTextInputHistory (const char *ident, const char *text); 629 /* returns the most recent text inputted into a text widget of this name, do not free result */ 630 char *CLastInput (const char *ident); 631 632 /* draws a fielded (like a ledger) text box */ 633 CWidget *CDrawFieldedTextbox (const char *identifier, Window parent, int x, int y, 634 int width, int height, int line, int column, 635 char **(*get_line) (void *, int, int *, int *), 636 long options, void *data); 637 638 struct file_entry { 639 unsigned long options; 640 char name[260]; 641 struct stat stat; 642 }; 643 644 char *get_file_list (const char *directory, unsigned long f, char *filter); 645 struct file_entry *get_file_entry_list (const char *directory, unsigned long options, char *filter); 646 char *user_file_list_search (Window parent, int x, int y, const char *base_name); 647 char *user_file_list_complete (Window parent, int x, int y, int lines, int columns, const char *base_name); 648 void get_file_time (char *timestr, time_t file_time, int l); 649 650 CWidget *CDrawFilelist (const char *identifier, Window parent, int x, int y, 651 int width, int height, int line, int column, 652 struct file_entry *directentry, 653 long options); 654 CWidget *CRedrawFilelist (const char *identifier, struct file_entry *directentry, int preserve); 655 struct file_entry *CGetFilelistLine (CWidget *w, int line); 656 657 /* Draws a scrollable textbox, with its scrollbar. text is newline seperate */ 658 CWidget *CDrawTextbox (const char *identifier, Window parent, int x, int y, 659 int width, int height, int line, int column, const char *text, long options); 660 #define TEXTBOX_BDR 8 661 char *CGetTextBoxLine (CWidget * w, int line); 662 CWidget *CDrawManPage (const char *identifier, Window parent, int x, int y, 663 int width, int height, int line, int column, const char *text); 664 /* Change the text of the textbox. If preserve is 1, then the position in the text is not altered */ 665 CWidget *CRedrawTextbox (const char *identifier, const char *text, int preserve); 666 CWidget *CRedrawFieldedTextbox (const char *identifier, int preserve); 667 CWidget *CClearTextbox (const char *identifier); 668 /* Set the position of the text in the text-box, see coolwidget.c */ 669 int CSetTextboxPos (CWidget * wdt, int which, long p); 670 671 /* Draws a thin horizontal raised ridge */ 672 CWidget *CDrawBar (Window parent, int x, int y, int w); 673 674 /* Vertical scroll bar */ 675 CWidget *CDrawVerticalScrollbar (const char *identifier, Window parent, int x, int y, 676 int length, int width, int pos, int prop); 677 CWidget *CDrawHorizontalScrollbar (const char *identifier, Window parent, int x, int y, 678 int length, int width, int pos, int prop); 679 void CSetScrollbarCallback (const char *scrollbar, const char *wiget, 680 void (*linktowiget) (CWidget *, 681 CWidget *, XEvent *, CEvent *, int)); 682 /* eg: void link_scrollbar_to_textbox (CWidget * w, CWidget * textbox, 683 XEvent * xevent, CEvent * cwevent, int which_scrollbar_button_was_pressed_1_to_5); */ 684 685 686 /* Draws one or more lines of text (separate by newlines) in a sunken panel. Use like printf() */ 687 CWidget *CDrawText (const char *identifier, Window parent, int x, int y, const char *fmt,...); 688 /* Will replace the text of an existing text widget. Unlike other widgets, multiple text widgets can have the same ident */ 689 CWidget *CRedrawText (const char *identifier, const char *fmt,...); 690 void CTextSize (int *w, int *h, const char *str); 691 692 /* Draws a file browser and returns a filename, file is the default file name */ 693 char *CGetFile (Window parent, int x, int y, 694 const char *dir, const char *file, const char *label); 695 char *CGetDirectory (Window parent, int x, int y, 696 const char *dir, const char *file, const char *label); 697 char *CGetSaveFile (Window parent, int x, int y, 698 const char *dir, const char *file, const char *label); 699 char *CGetLoadFile (Window parent, int x, int y, 700 const char *dir, const char *file, const char *label); 701 702 /* Draws a directory browser and returns immediately */ 703 void CDrawBrowser (const char *ident, Window parent, int x, int y, 704 const char *dir, const char *file, const char *label); 705 706 707 /* Draws a simple spreadsheat widget (not supprted) */ 708 CWidget *CDrawSpreadSheet (const char *ident, Window parent, int x, int y, int w, int h, const char *spreadtext, const char *heading, int *columns); 709 710 /* Draws a full blown text editor, scrollbar and status line */ 711 CWidget *CDrawEditor (const char *identifier, Window parent, int x, int y, 712 int width, int height, const char *text, const char *filename, 713 const char *starting_directory, unsigned int options, unsigned long text_size); 714 715 void CSetCursorColor (unsigned long c); 716 717 /* Draws a menu button that may be pulled down if clicked on */ 718 CWidget *CDrawMenuButton (const char *ident, Window parent, Window focus_return, 719 int x, int y, int width, int height, int num_items, const char *label,...); 720 /* this is a menu item: */ 721 /* ...label, const char *text, int hot_key, callfn call_back, unsigned long data,...); */ 722 void CSetMenuFocusReturn (const char *ident, Window w); 723 void CSetLastMenu (CWidget * button); 724 CWidget *CGetLastMenu (void); 725 void CMenuSelectionDialog (CWidget * button); 726 CWidget *get_pulled_menu (void); 727 728 729 /* Draws menu buttons for the editor. focus_return is where focus goes to if you escape from a menu */ 730 void CDrawEditMenuButtons (const char *ident, Window parent, Window focus_return, int x, int y); 731 void CAddMenuItem (const char *ident, const char *text, int hot_key, callfn call_back, unsigned long data); 732 void CRemoveMenuItem (const char *ident, const char *text); 733 void CReplaceMenuItem (const char *ident, const char *old_text, const char *new_text, int hot_key, callfn call_back, unsigned long data); 734 void CRemoveMenuItemNumber (const char *ident, int i); 735 void CInsertMenuItem (const char *ident, const char *after, const char *text, int hot_key, callfn call_back, unsigned long data); 736 void CInsertMenuItemAfter (const char *ident, const char *after, const char *text, int hot_key, callfn call_back, unsigned long data); 737 int CHasMenuItem (const char *ident, const char *text); /* returns -1 or menu item number */ 738 739 /* Draws a bitmap inside a sunken window */ 740 CWidget *CDrawBitmap (const char *identifier, Window parent, int x, int y, 741 int width, int height, unsigned long fg, unsigned long bg, const unsigned char *data); 742 743 /* Draws a black and white picture 1 byte per pixel contiguous data */ 744 CWidget *CDrawBWImage (const char *identifier, Window parent, int x, int y, 745 int width, int height, unsigned char *data); 746 747 XImage *CCreateImage (const char *data[], int width, int height, char start_char); 748 Pixmap CCreatePixmap (const char *data[], int width, int height, char start_char); 749 Pixmap CCreateClipMask (const char *data[], int width, int height, char start_char); 750 751 752 /* A window with inward bevels */ 753 CWidget *CDrawSunkenPanel (const char *identifier, Window parent, int x, int y, 754 int width, int height, const char *label); 755 756 /* Draw a progress bar */ 757 CWidget *CDrawProgress (const char *identifier, Window parent, int x, int y, 758 int width, int height, int p); 759 760 /* Draws a picture, containing nothing. Allows lines, rectangles etc to 761 be drawn into the picture */ 762 CWidget *CDrawPicture (const char *identifier, Window parent, int x, int y, 763 int max_num_elements); 764 765 766 /* Destroy a widget. This will destroy all descendent widgets recursively */ 767 int CDestroyWidget (const char *identifier); 768 769 /* Used internally, or for creating you own widgets, see coolwidget.c */ 770 CWidget *CSetupWidget (const char *identifier, Window parent, int x, int y, 771 int width, int height, int kindofwidget, unsigned long input, 772 unsigned long bgcolor, int takes_focus); 773 /* call before drawing a widget to the root window to stop the window manager 774 of creating a border for you, */ 775 void CSetOverrideRedirect (void); 776 /* then clear after drawing the widget */ 777 void CClearOverrideRedirect (void); 778 779 780 /* For resizing and reposition a widget */ 781 void CSetWidgetSize (const char *ident, int w, int h); 782 void CSetSize (CWidget * wt, int w, int h); 783 void CSetWidgetPosition (const char *ident, int x, int y); 784 785 /* Forces the a widget to be entirely redrawn */ 786 void CExpose (const char *ident); 787 788 /* Sends an expose event to a window */ 789 void CExposeWindowArea (Window win, int count, int x, int y, int w, int h); 790 791 /* Sends an event to the coolwidget queue. Use instead of XSendEvent */ 792 int CSendEvent (XEvent * e); 793 794 795 /* add a callback to a widget. Will be called if anything relevent happens 796 to the widget. callback must return 1 if they handles a key press */ 797 void CAddCallback (const char *ident, int (*callback) (CWidget *, XEvent *, CEvent *)); 798 void CAddBeforeCallback (const char *ident, int (*callback) (CWidget *, XEvent *, CEvent *)); 799 800 /* send the text box a command (such as XK_Left or XK_Down to scroll) */ 801 int CTextboxCursorMove (CWidget * w, KeySym key); 802 803 /* forces all windows set to CALWAYS_NO_TOP (see above) to be raised */ 804 void CRaiseWindows (void); 805 /* same for ALWAYS_ON_BOTTOM, call these after raising or lowering 806 a window, to keep the "underneath" windows where they should be 807 (eg the coolwidget logo in the top left of the screen */ 808 void CLowerWindows (void); 809 810 /* 811 The hinge of this whole library. This handles widget events and calls 812 the callback routines. It must go in the main loop of a program. 813 Returns cwevent->handled == 1 if the event was a key event and was 814 handled, 0 otherwise. 815 */ 816 void CNextEvent (XEvent * xevent, CEvent * cwevent); 817 818 /* Any events left? */ 819 int CPending (void); 820 821 /* key presses waiting ? */ 822 int CKeyPending (void); 823 824 /* Any events left on coolwidgets own event queue? */ 825 int CQueueSize (void); 826 827 /* Do not use the libc sleep command. This sleeps for t seconds, 828 resolution is 1/50 of a second */ 829 void CSleep (double t); 830 831 /* Do not use the libc system command */ 832 int CSystem (const char *string); 833 834 /* Destroy all widgets */ 835 void CDestroyAll (void); 836 837 /* All widgets may be either enabled or disabled, meaning they either 838 recieve input from the mouse and keyboard, or not. This backs up the 839 state of all widgets into the structure CState. See dialog.c for an 840 example */ 841 void CBackupState (CState * s); 842 /* This restore the state from the structure */ 843 void CRestoreState (CState * s); 844 845 /* Disable a widget. ident may be a regular expression. */ 846 void CDisable (const char *ident); 847 /* Enable */ 848 void CEnable (const char *ident); 849 850 /* set the focus to a widget */ 851 void CFocus (CWidget * w); 852 853 /* set the focus, but not if the window manager is focussed elsewhere, 854 and option_never_raise_wm_windows is set */ 855 int CTryFocus (CWidget * w, int raise_wm_window); 856 857 /* set the focus to a window */ 858 void CFocusWindow (Window win); 859 860 /* get the current focus */ 861 Window CGetFocus (void); 862 863 /* get the current window of the input method */ 864 Window CGetICFocus(void); 865 866 /* pull up or down a menu */ 867 void CPullDown (CWidget * button); 868 void CPullUp (CWidget * button); 869 870 /* set the editor that editmenu will send commands to */ 871 void CSetEditMenu (const char *ident); 872 void CEditMenuCommand (int i); 873 CWidget *CGetEditMenu (void); 874 void CEditMenuKey (KeySym i, int state); 875 876 /* internal */ 877 int CSendExpose (Window win, int x, int y, int w, int h); 878 879 /* cursor blink rate */ 880 int CGetCursorBlinkRate (void); 881 void CSetCursorBlinkRate (int times_per_second); 882 883 884 /************* the rest is not properly documented **************/ 885 886 /* check magic number to detect a memory leak */ 887 int widget_check_magic (void); 888 889 /* convert button press to double click */ 890 void resolve_button (XEvent * xevent, CEvent * cwevent); 891 892 893 #ifdef DRAWINGS_C 894 CWidget *CDrawTarget; 895 #else 896 extern CWidget *CDrawTarget; 897 #endif 898 899 /* Focus ordering */ 900 CWidget *CFindFirstDescendent (Window win); 901 int find_next_child_of (Window win, Window child); 902 int find_previous_child_of (Window win, Window child); 903 int find_first_child_of (Window win); 904 int find_last_child_of (Window win); 905 906 /* returns the widgets index */ 907 int widget_of_window (Window win); 908 909 /* returns the main window that a widget is a descendent of */ 910 Window CFindParentMainWindow (Window win); 911 912 /* there are two cursor types */ 913 #define CURSOR_TYPE_TEXTINPUT 1 914 #define CURSOR_TYPE_EDITOR 2 915 916 /* set the cursor position (internal) */ 917 void set_cursor_position (Window win, int x, int y, int w, int h, int type, wchar_t chr, unsigned long fg, unsigned long bg, int style); 918 919 /* translates a key press to a keysym */ 920 KeySym CKeySym (XEvent * e); 921 /* some by converts to a short with upper bits representing the state */ 922 short CKeySymMod (XEvent * e); 923 /* get the current state of the keyboard and mouse */ 924 unsigned int CGetKeyBoardState (void); 925 926 /* match regular expressions */ 927 int regexp_match (char *pattern, char *string, int match_type); 928 929 /* gets a widgets position relative to some ancestor widget */ 930 void CGetWindowPosition (Window win, Window ancestor, int *x_return, int *y_return); 931 932 CWidget *CNextFocus (CWidget * w); 933 CWidget *CPreviousFocus (CWidget * w); 934 CWidget *CChildFocus (CWidget * w); 935 936 void reset_hint_pos (int x, int y); 937 void set_hint_pos (int x, int y); 938 void CGetHintPos (int *x, int *y); 939 void get_hint_limits (int *max_x, int *max_y); 940 void CSetSizeHintPos (const char *ident); 941 942 /* disable alarm sets and unsets the signal handler: might 943 be necesary with some system calls */ 944 void CEnableAlarm (void); 945 void CDisableAlarm (void); 946 947 /* see pipe.c for what these do. triple_pipe_open is very useful for piping processes. */ 948 /* set your own SIGCHLD handler though */ 949 void set_signal_handlers_to_default (void); 950 char *read_pipe (int fd, int *len); 951 pid_t triple_pipe_open (int *in, int *out, int *err, int mix, const char *file, char *const argv[]); 952 pid_t open_under_pty (int *in, int *out, char *line, const char *file, char *const argv[]); 953 954 /* see coolnext.c for details */ 955 int CCheckWindowEvent (Window w, long event_mask, XEvent ** event_return); 956 957 double my_log (double x); 958 double my_sqrt (double x); 959 double my_pow (double x, double y); 960 961 #ifdef HAVE_MAD 962 #define CMalloc(x) mad_alloc(x, __FILE__, __LINE__) 963 #endif 964 965 #ifdef DEBUG 966 #ifndef HAVE_MAD 967 #define CMalloc(x) CDebugMalloc(x, __LINE__, __FILE__) 968 #endif 969 #endif 970 971 /* #define FOCUS_DEBUG */ 972 973 #ifdef FOCUS_DEBUG 974 #define CFocus(x) CFocusDebug(x,__LINE__,__FILE__) 975 #define CFocusWindow(x) CFocusWindowDebug(x,__LINE__,__FILE__) 976 #else 977 #define CFocus(x) CFocusNormal(x) 978 #define CFocusWindow(x) CFocusWindowNormal(x) 979 #endif 980 981 982 void CFocusDebug (CWidget * w, int line, char *file); 983 void CFocusNormal (CWidget * w); 984 void CFocusWindowDebug (Window w, int line, char *file); 985 void CFocusWindowNormal (Window w); 986 void CFocusLast (void); 987 988 /* get last decendent focussed with the specified main window */ 989 Window *CGetLastFocussedInMain (Window main); 990 991 /* resizing stuff */ 992 void CCentre (char *ident); 993 void CSetMovement (const char *ident, unsigned long position); 994 995 /* send an event to a window with a direct call */ 996 int CSendMessage (CWidget * w, int msg); 997 998 /* set and unset the hourglass for this window */ 999 void CHourGlass (Window win); 1000 void CUnHourGlass (Window win); 1001 1002 void get_home_dir (void); 1003 1004 1005 /* drag and drop stuff */ 1006 1007 /* do a drag */ 1008 void CDrag (Window from, int data_type, unsigned char *data, int length, unsigned long pointer_state); 1009 1010 /* get drop text, type is returned */ 1011 int CGetDrop (XEvent * xe, unsigned char **data, unsigned long *size, int *x, int *y); 1012 1013 /* send a drop ack event */ 1014 void CDropAcknowledge (XEvent * xe); 1015 1016 /* check if event is a drop ack event */ 1017 int CIsDropAcknowledge (XEvent * xe, unsigned int *state); 1018 1019 /* find the pointer x and y position within the window it is over */ 1020 Window CQueryPointer (int *x, int *y, unsigned int *mask); 1021 1022 /* set and get the directory to be prependent onto drags */ 1023 #ifdef HAVE_DND 1024 char *CDndDirectory (void); 1025 char *CDndFileList (char *t, int *l, int *num_files); 1026 #endif 1027 void CSetDndDirectory (char *d); 1028 1029 #define CURSOR_HOUR 0 1030 #define CURSOR_LEFT 1 1031 #define CURSOR_MENU 2 1032 Cursor CGetCursorID (int i); 1033 1034 void XDrawVericalString8x16 (Display * display, Drawable d, GC gc, 1035 int x, int y, char *string, int length); 1036 1037 #define DndNotDnd -1 1038 #define DndUnknown 0 1039 #define DndRawData 1 1040 #define DndFile 2 1041 #define DndFiles 3 1042 #define DndText 4 1043 #define DndDir 5 1044 #define DndLink 6 1045 #define DndExe 7 1046 #define DndURL 8 1047 #define DndMIME 9 1048 1049 #define DndEND 10 1050 1051 #define dnd_null_term_type(d) \ 1052 ((d) == DndFile || (d) == DndText || (d) == DndDir || \ 1053 (d) == DndLink || (d) == DndExe || (d) == DndURL) 1054 1055 char *CDndFileList (char *t, int *l, int *num_files); 1056 1057 /* dialogs */ 1058 1059 void CFatalErrorDialog (int x, int y, const char *fmt,...); 1060 1061 #define INPUT_DIALOG_BROWSE_MASK (3<<14) 1062 #define INPUT_DIALOG_BROWSE_NONE (0<<14) 1063 #define INPUT_DIALOG_BROWSE_LOAD (1<<14) 1064 #define INPUT_DIALOG_BROWSE_SAVE (2<<14) 1065 #define INPUT_DIALOG_BROWSE_DIR (3<<14) 1066 char *CInputDialog (const char *ident, Window in, int x, int y, int min_width, const char *def, const char *heading, const char *fmt,...); 1067 int CQueryDialog (Window in, int x, int y, const char *heading, const char *first,...); 1068 void CErrorDialog (Window in, int x, int y, const char *heading, const char *fmt,...); 1069 void CMessageDialog (Window in, int x, int y, unsigned long options, const char *heading, const char *fmt,...); 1070 void CTextboxMessageDialog (Window in, int x, int y, int width, int height, const char *heading, const char *text, int line); 1071 int CListboxDialog (Window in, int x, int y, int columns, int lines, 1072 const char *heading, int start_line, int cursor_line, int num_lines, 1073 char *(*get_line) (void *data, int line), void *data); 1074 long CUnicodeDialog (Window in, int x, int y, char *heading); 1075 char *get_sys_error (const char *s); 1076 XEvent *CRawkeyQuery (Window in, int x, int y, const char *heading, const char *fmt,...); 1077 char *CTrivialSelectionDialog (Window in, int x, int y, int columns, int lines, const char *text, int line, int cursor_line); 1078 1079 struct focus_win { 1080 Window top, bottom, left, right; 1081 Window current; 1082 int width, height; 1083 int border; 1084 }; 1085 1086 int inbounds (int x, int y, int x1, int y1, int x2, int y2); 1087 1088 struct look { 1089 int (*get_default_interwidget_spacing) (void); 1090 void (*menu_draw) (Window win, int w, int h, struct menu_item m[], int n, int light); 1091 void (*get_menu_item_extents) (int n, int j, struct menu_item m[], int *border, int *relief, 1092 int *y1, int *y2); 1093 void (*render_menu_button) (CWidget * wdt); 1094 void (*render_button) (CWidget * wdt); 1095 void (*render_bar) (CWidget * wdt); 1096 void (*render_raised_bevel) (Window win, int x1, int y1, int x2, int y2, int thick, int sunken); 1097 void (*render_sunken_bevel) (Window win, int x1, int y1, int x2, int y2, int thick, int sunken); 1098 void (*draw_hotkey_understroke) (Window win, int x, int y, int hotkey); 1099 char *(*get_default_widget_font) (void); 1100 void (*render_text) (CWidget * wdt); 1101 void (*render_window) (CWidget * wdt); 1102 void (*render_scrollbar) (CWidget * wdt); 1103 int (*get_scrollbar_size) (int type); 1104 void (*init_scrollbar_icons) (CWidget * wdt); 1105 int (*which_scrollbar_button) (int bx, int by, CWidget * wdt); 1106 int (*scrollbar_handler) (CWidget * w, XEvent * xevent, CEvent * cwevent); 1107 void (*get_button_color) (XColor * color, int i); 1108 int (*get_extra_window_spacing) (void); 1109 int (*window_handler) (CWidget * w, XEvent * xevent, CEvent * cwevent); 1110 int (*get_focus_ring_size) (void); 1111 unsigned long (*get_button_flat_color) (void); 1112 int (*get_window_resize_bar_thickness) (void); 1113 void (*render_switch) (CWidget * wdt); 1114 int (*get_switch_size) (void); 1115 void (*draw_browser) (const char *ident, Window parent, int x, int y, const char *dir, 1116 const char *file, const char *label); 1117 char *(*get_file_or_dir) (Window parent, int x, int y, const char *dir, const char *file, 1118 const char *label, int options); 1119 CWidget *(*draw_file_list) (const char *identifier, Window parent, int x, int y, 1120 int width, int height, int line, int column, 1121 struct file_entry * directentry, long options); 1122 CWidget *(*redraw_file_list) (const char *identifier, struct file_entry * directentry, 1123 int preserve); 1124 struct file_entry *(*get_file_list_line) (CWidget * w, int line); 1125 void (*search_replace_dialog) (Window parent, int x, int y, char **search_text, 1126 char **replace_text, char **arg_order, const char *heading, 1127 int option); 1128 void (*edit_render_tidbits) (CWidget * wdt); 1129 CWidget *(*draw_exclam_cancel_button) (char *ident, Window win, int x, int y); 1130 CWidget *(*draw_tick_cancel_button) (char *ident, Window win, int x, int y); 1131 CWidget *(*draw_cross_cancel_button) (char *ident, Window win, int x, int y); 1132 CWidget *(*draw_tick_ok_button) (char *ident, Window win, int x, int y); 1133 void (*render_fielded_textbox_tidbits) (CWidget * w, int isfocussed); 1134 void (*render_textbox_tidbits) (CWidget * w, int isfocussed); 1135 int (*get_fielded_textbox_hscrollbar_width) (void); 1136 void (*render_textinput_tidbits) (CWidget * wdt, int isfocussed); 1137 void (*render_passwordinput_tidbits) (CWidget * wdt, int isfocussed); 1138 void (*render_focus_border) (Window win); 1139 }; 1140 1141 #include "edit.h" 1142 #include "editcmddef.h" 1143 #include "imagewidget.h" 1144 1145 #endif 1146 1147 1148