aui.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 618 行 · 第 1/2 页

H
618
字号
/****************************************************************************
*
*                            Open Watcom Project
*
*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
*  ========================================================================
*
*    This file contains Original Code and/or Modifications of Original
*    Code as defined in and that are subject to the Sybase Open Watcom
*    Public License version 1.0 (the 'License'). You may not use this file
*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
*    provided with the Original Code and Modifications, and is also
*    available at www.sybase.com/developer/opensource.
*
*    The Original Code and all software distributed under the License are
*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  Public interface to the AUI (Advanced UI) library.
*
****************************************************************************/


#ifndef _AUI_H_INCLUDED
#define _AUI_H_INCLUDED

#include "gui.h"
#include "guikey.h"
#include "guifdlg.h"

#if defined(_AUIPVT_H_INCLUDED) || defined(AUI_DBG)
    #define a_window struct aui_private_window_structure
#else
    struct a_window;
    typedef struct a_window a_window;
#endif

#include "bool.h"
#ifndef NULL
    #define NULL ((void*)0)
#endif

#define SAVE_SIZE               512

typedef struct {
    unsigned char       area[SAVE_SIZE];
    unsigned            first_cmd;
    unsigned            first_free;
    unsigned            curr_cmd;
    bool                last_was_next;
} save_area;

#define MIN_DCLICK      100
#define MAX_DCLICK      1500
#define MAX_MAGIC_STR   20
#define WND_NO_PIECE    255
#define MAX_KEY_SIZE    256
#define MAX_POPUPS      20
#define WND_MAX_COL     32767
#define WND_NO_COL      WND_MAX_COL
// make sure WND_MAX_ROW + WndRows(wnd) will never wrap
#define WND_MAX_ROW     ((wnd_row)32000)
#define WND_NO_ROW      (-WND_MAX_ROW)
#define WND_APPROX_SIZE 10000
#define WND_NO_CLASS    ((wnd_class)-1)

#define WND_SAVE_ROW    0
#define WND_RESTORE_ROW 1

#define WND_CURRENT_CHANGED     GUI_NO_EVENT // sent when WndDirtyCurr called



typedef enum {
    WND_FIRST_UNUSED = GUI_FIRST_UNUSED,
} wnd_attr;

#define WND_MENU_POPUP  GUI_UTIL_1

#define WSW_LBUTTON_SELECTS             0x00000001L     // default off
#define WSW_MULTILINE_SELECT            0x00000002L     // default off
#define WSW_SUBWORD_SELECT              0x00000004L     // default off
#define WSW_MAP_CURSOR_TO_SCROLL        0x00000008L     // default off
#define WSW_RBUTTON_CHANGE_CURR         0x00000010L     // default off
#define WSW_SELECT_IN_TABSTOP           0x00000020L     // default on
#define WSW_MUST_CLICK_ON_PIECE         0x00000040L     // default off
#define WSW_RBUTTON_SELECTS             0x00000080L  // default off
#define WSW_CHOOSING                    0x00000100L  // default off
#define WSW_CHAR_CURSOR                 0x00000200L  // default off
#define WSW_ALLOW_POPUP                 0x00000400L  // default on
#define WSW_SEARCH_WRAP                 0x00000800L  // default on
#define WSW_HIGHLIGHT_CURRENT           0x00001000L  // default on
#define WSW_ONLY_MODIFY_TABSTOP         0x00002000L  // default on
#define WSW_UTIL_1                      0x00100000L
#define WSW_CLICKED                     0x00200000L
#define WSW_DCLICKED                    0x00400000L
#define WSW_CACHE_LINES                 0x00800000L
#define WSW_SELECTING_WITH_KEYBOARD     0x01000000L
#define WSW_SELECT_EVENT                0x02000000L
#define WSW_REPAINT                     0x04000000L
#define WSW_ALTERNATE_BIT               0x08000000L  // default off
#define WSW_ICONIFIED                   0x10000000L
#define WSW_SELECTING                   0x20000000L
#define WSW_ACTIVE                      0x40000000L
#define WSW_MENU_ACCURATE_ROW           0x80000000L

typedef unsigned long wnd_switches;


typedef int             wnd_row;
typedef char            wnd_class;
typedef unsigned long   wnd_update_list;

typedef struct wnd_line_piece {
    char        *text;                  // default ""
    wnd_attr    attr;                   // default WND_PLAIN
    gui_ord     indent;                 // default 0
    gui_ord     extent;                 // default WND_NO_EXTEND
    unsigned    tabstop         : 1;    // default on
    unsigned    static_text     : 1;    // default off
    unsigned    hot             : 1;    // default off
    unsigned    underline       : 1;    // default off
    unsigned    use_key         : 1;    // default on
    unsigned    use_piece0_attr : 1;    // default off
    unsigned    use_prev_attr   : 1;    // default off
    unsigned    bitmap          : 1;    // default off
    unsigned    master_tabstop  : 1;    // default off
    unsigned    draw_bar        : 1;    // default off
    unsigned    vertical_line   : 1;    // default off
    unsigned    draw_hook       : 1;    // default off
    unsigned    draw_line_hook  : 1;    // default off
    unsigned    length;                 // INTERNAL -- do not use
    char        *hint;                  // set for Hint Text
} wnd_line_piece;

#define WND_NO_EXTEND   0
#define WND_MAX_EXTEND  GUI_NO_COLUMN

typedef struct wnd_create_struct {
    struct wnd_info     *info;
    char                *text;
    wnd_class           class;
    void                *extra;
    gui_create_styles   style;
    gui_scroll_styles   scroll;
    gui_colour_set      *colour;
    gui_rect            rect;
    int                 title_size;
} wnd_create_struct;

typedef struct wnd_posn {
    float               x,y;
    float               width,height;
} wnd_posn;


typedef int wnd_menu_id;

#define MENU_INITIALIZE ((wnd_menu_id)-1)

typedef struct {
    wnd_row             row;
    int                 piece;
    int                 col;
} wnd_coord;

typedef struct {
    wnd_row             row;
    int                 piece;
    int                 col;
    int                 end_col;
} wnd_dirt;

typedef struct {
    wnd_row             row;
    int                 piece;
    int                 col;
    int                 end;
} wnd_subpiece;

typedef struct {
    wnd_row             min_rows;
    int                 min_cols;
    wnd_row             max_rows;
    int                 max_cols;
} wnd_metrics;

typedef struct {
    gui_bar_styles      bar_style;
    gui_colour          bar_colour;
    gui_colour          bar_colour2;
    gui_ord             bar_size2;
    unsigned            bar_group    : 1;
    unsigned            bar_selected : 1;
} wnd_bar_info;


#define __WND_FIELD( wnd, field ) (((struct aui_private_window_structure *)(wnd))->field )
#define WndExtra( wnd ) __WND_FIELD( wnd, extra )
#define WndPopItem( wnd ) __WND_FIELD( wnd, popitem )
#define WndSrchItem( wnd ) __WND_FIELD( wnd, searchitem )
#define WndMaxCharX( wnd ) __WND_FIELD( wnd, max_char.x )
#define WndMaxCharY( wnd ) __WND_FIELD( wnd, max_char.y )
#define WndAvgCharX( wnd ) __WND_FIELD( wnd, avg_char_x )
#define WndMidCharX( wnd ) __WND_FIELD( wnd, mid_char_x )
#define WndTop( wnd ) __WND_FIELD( wnd, top )
#define WndSetTop( wnd, x ) __WND_FIELD( wnd, top ) = x
#define WndHasClass( wnd ) ( __WND_FIELD( wnd, class ) != WND_NO_CLASS )
#define WndClass( wnd ) __WND_FIELD( wnd, class )
#define WndTitleSize( wnd ) (__WND_FIELD( wnd, title_size ))
#define WndRows( wnd ) (__WND_FIELD( wnd, rows )-__WND_FIELD( wnd, title_size ))
#define WndMaxRow( wnd ) __WND_FIELD( wnd, max_row )
#define WndGui( wnd ) __WND_FIELD( wnd, gui )
#define WndWidth( wnd ) __WND_FIELD( wnd, width )
#define WndRepaint( wnd ) __WND_FIELD( wnd, switches ) |= WSW_REPAINT
#define WndSetKey( wnd, x ) __WND_FIELD( wnd, keypiece ) = (x)
#define WndKeyPiece( wnd ) __WND_FIELD( wnd, keypiece )
#define WndSetSwitches( wnd, x ) __WND_FIELD( wnd, switches ) |= (x)
#define WndSwitchOn( wnd, x ) ( __WND_FIELD( wnd, switches ) & (x) )
#define WndClrSwitches( wnd, x ) __WND_FIELD( wnd, switches ) &= ~(x)
#define WndNumPopups( wnd ) __WND_FIELD( wnd, num_popups )
#define WndPopupMenu( wnd ) __WND_FIELD( wnd, popupmenu )

typedef struct aui_private_window_structure {
    gui_window              *gui;
    union { // to avoid global recompiles
        struct aui_private_window_structure *__free_field;
        struct {
            char            row;
            char            piece;
        } button_down;
    } u;
    void                    *extra;
    struct wnd_info         *info;
    char                    *popitem;
    char                    *searchitem;
    wnd_coord               sel_start;
    wnd_coord               sel_end;
    wnd_coord               current;
    wnd_row                 rows;
    gui_coord               max_char;
    gui_ord                 width;
    gui_ord                 max_indent;
    int                     top;
    char                    button_down_screen_row;
    char                    keyindex;
    char                    keypiece;
    wnd_class               class;
    wnd_switches            switches;
    int                     vscroll_pending;
    int                     hscroll_pending;
    wnd_row                 max_row;
    char                    *select_chars;
    int                     title_size;
    gui_ord                 avg_char_x;
    gui_ord                 mid_char_x;
    int                     last_popup;
    int                     current_col;
    char                    num_popups;
    gui_menu_struct         *popupmenu;
    char                    dirtyrects;
    wnd_dirt                dirty[1];
} aui_private_window_structure;



typedef bool (WNDCALLBACK)( a_window *, gui_event, void * );
typedef void (WNDREFRESH)( a_window * );
typedef void (WNDMENU)( a_window *, unsigned, int, int );
typedef void (WNDMODIFY)( a_window *, int, int );
typedef int (WNDSCROLL)( a_window *, int );
typedef int (WNDNUMROWS)( a_window * );
typedef int (WNDNEXTROW)( a_window *, int, int );
typedef bool (WNDGETLINE)( a_window *wnd, wnd_row row, int piece, wnd_line_piece * );
typedef void (WNDNOTIFY)( a_window *wnd, wnd_row row, int piece );
typedef void (WNDBEGPAINT)( a_window *wnd, wnd_row row, int num );
typedef void (WNDENDPAINT)( a_window *wnd, wnd_row row, int num );
typedef a_window * (WNDOPEN)( void );
typedef a_window *(WNDCREATE)( char *, struct wnd_info *, wnd_class, void * );
typedef void (WNDCLOSE)( a_window * );


typedef struct wnd_info {
        WNDCALLBACK             *event;
        WNDREFRESH              *refresh;
        WNDGETLINE              *getline;
        WNDMENU                 *menuitem;
        WNDSCROLL               *scroll;
        WNDBEGPAINT             *begpaint;
        WNDENDPAINT             *endpaint;
        WNDMODIFY               *modify;
        WNDNUMROWS              *numrows;
        WNDNEXTROW              *nextrow;
        WNDNOTIFY               *notify;
        wnd_update_list         flags;
        char                    num_popups;
        gui_menu_struct         *popupmenu;
} wnd_info;


typedef char*           DLGPICKTEXT( void *, int );

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?