stdui.h

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

H
713
字号
/****************************************************************************
*
*                            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:  User Interface (UI) library public interface.
*
****************************************************************************/


#ifndef _STDUI_H_INCLUDED_
#define _STDUI_H_INCLUDED_

#ifndef         _FAR
#define         _FAR
#endif

#ifndef         _FARD
#define         _FARD
#endif

#define         EV_NO_EVENT             0x00
#define         EV_FIRST_EVENT          0x01

#define         EV_FIRST_EDIT_CHAR      0x01
#define         EV_LAST_EDIT_CHAR       0xfe

#define         EV_RUB_OUT              0x108
#define         EV_TAB_FORWARD          0x109
#define         EV_RETURN               0x10D
#define         EV_ENTER                0x10D
#define         EV_CTRL_ENTER           0x00A
#define         EV_CTRL_RETURN          0x00A
#define         EV_CTRL_BACKSPACE       0x07F
#define         EV_ESCAPE               0x11B
/*
 * This next one isn't all that useful on AT-class machines, I grant you.
 * But - it could be useful on the NEC, to provide a nice interface for
 * quitting or resetting.  Just a thought.
 */
#define         EV_CTRL_ALT_DELETE      0x3FF

/*
 * I'm putting these hitherto undefined constants at the end of the
 * event list, defining them rather than enumming them, since they don't
 * really correspond to codes which are automatically generated.
 * However, they can be detected by windows, and I wish to be consistent.
 * Be on the lookout, though - not every platform can detect all these
 * different keystrokes.  CSK
 */

#if !defined( NO_SHIFT_MOVEMENT )
#define         EV_SHIFT_HOME           0x1C0
#define         EV_SHIFT_END            0x1C1

#define         EV_SHIFT_CURSOR_UP      0x1C2
#define         EV_SHIFT_CURSOR_DOWN    0x1C3
#define         EV_SHIFT_CURSOR_LEFT    0x1C4
#define         EV_SHIFT_CURSOR_RIGHT   0x1C5

#define         EV_SHIFT_PAGE_UP        0x1C6
#define         EV_SHIFT_PAGE_DOWN      0x1C7
#endif

#define         EV_CTRL( k )            ( (k) - 'a' + 1 )
#define         EV_ALT_KEYPAD( k )      (k)

#define         EV_FUNC( n )            ( 0x13A + (n) )
#define         EV_SHIFT_FUNC( n )      ( 0x153 + (n) )
#define         EV_CTRL_FUNC( n )       ( 0x15d + (n) )
#define         EV_ALT_FUNC( n )        ( 0x167 + (n) )

#define         EV_FUNC_11              0x185
#define         EV_FUNC_12              0x186
#define         EV_SHIFT_FUNC_11        0x187
#define         EV_SHIFT_FUNC_12        0x188
#define         EV_CTRL_FUNC_11         0x189
#define         EV_CTRL_FUNC_12         0x18A
#define         EV_ALT_FUNC_11          0x18B
#define         EV_ALT_FUNC_12          0x18C

#define         EV_TAB_BACKWARD         0x10F

typedef int EVENT;  /* must be signed for uiungetevent */

enum {
        EV_ALT_Q                        = 0x110,
        EV_ALT_W,
        EV_ALT_E,
        EV_ALT_R,
        EV_ALT_T,
        EV_ALT_Y,
        EV_ALT_U,
        EV_ALT_I,
        EV_ALT_O,
        EV_ALT_P,
        EV_ALT_LEFT_BRACKET,
        EV_ALT_RIGHT_BRACKET,
        EV_ALT_ENTER,
        EV_ALT_A                        = 0x11e,
        EV_ALT_S,
        EV_ALT_D,
        EV_ALT_F,
        EV_ALT_G,
        EV_ALT_H,
        EV_ALT_J,
        EV_ALT_K,
        EV_ALT_L,
        EV_ALT_SEMI_COLON,
        EV_ALT_QUOTE,
        EV_ALT_BACKQUOTE,
        EV_ALT_BACKSLASH                = 0x12b,
        EV_ALT_Z                        = 0x12c,
        EV_ALT_X,
        EV_ALT_C,
        EV_ALT_V,
        EV_ALT_B,
        EV_ALT_N,
        EV_ALT_M,
        EV_ALT_COMMA,
        EV_ALT_PERIOD,
        EV_ALT_SLASH,
        EV_ALT_SPACE,
        EV_HOME                         = 0x147,
        EV_CURSOR_UP,
        EV_PAGE_UP,
        EV_CURSOR_LEFT                  = 0x14B,
        EV_CURSOR_RIGHT                 = 0x14D,
        EV_END                          = 0x14F,
        EV_CURSOR_DOWN,
        EV_PAGE_DOWN,
        EV_INSERT,
        EV_DELETE,
        EV_CTRL_CURSOR_LEFT             = 0x173,
        EV_CTRL_CURSOR_RIGHT,
        EV_CTRL_END,
        EV_CTRL_PAGE_DOWN,
        EV_CTRL_HOME,
        EV_ALT_1                        = 0x178,
        EV_ALT_2,
        EV_ALT_3,
        EV_ALT_4,
        EV_ALT_5,
        EV_ALT_6,
        EV_ALT_7,
        EV_ALT_8,
        EV_ALT_9,
        EV_ALT_0,
        EV_ALT_MINUS,
        EV_ALT_EQUAL,
        EV_CTRL_PAGE_UP                 = 0x184,
#ifdef FD6
        EV_LAST_KEYBOARD,
#else
        EV_CTRL_CURSOR_UP               = 0x18d,
        EV_CTRL_CURSOR_DOWN             = 0x191,
        EV_CTRL_INSERT,
        EV_CTRL_DELETE,
        EV_CTRL_TAB,
        EV_ALT_HOME                     = 0x197,
        EV_ALT_CURSOR_UP,
        EV_ALT_PAGE_UP,
        EV_ALT_CURSOR_LEFT              = 0x19b,
        EV_ALT_CURSOR_RIGHT             = 0x19d,
        EV_ALT_END                      = 0x19f,
        EV_ALT_CURSOR_DOWN              = 0x1a0,
        EV_ALT_PAGE_DOWN,
        EV_ALT_INSERT,
        EV_ALT_DELETE,

        EV_LAST_KEYBOARD                = 0x1ff,
#endif
        EV_SHOW_FIELD,
        EV_MODIFIED_FIELD,
        EV_LINE_CHANGE,
        EV_MOUSE_HOLD,
        EV_MOUSE_PRESS,
        EV_MOUSE_DRAG,
        EV_MOUSE_RELEASE,
        EV_BUFFER_FULL,
        EV_FIELD_CHANGE,
        EV_ALT_PRESS,
        EV_ALT_RELEASE,
        EV_MOUSE_DCLICK,
        EV_MOUSE_REPEAT,
        EV_SHIFT_PRESS,
        EV_SHIFT_RELEASE,
        EV_CTRL_PRESS,
        EV_CTRL_RELEASE,
        EV_SCROLL_PRESS,
        EV_SCROLL_RELEASE,
        EV_NUM_PRESS,
        EV_NUM_RELEASE,
        EV_CAPS_PRESS,
        EV_CAPS_RELEASE,
        EV_INSERT_PRESS,
        EV_INSERT_RELEASE,

        EV_CLOCK_TICK,
        EV_SINK,

        EV_MOUSE_HOLD_R,
        EV_MOUSE_PRESS_R,
        EV_MOUSE_DRAG_R,
        EV_MOUSE_RELEASE_R,
        EV_MOUSE_DCLICK_R,
        EV_MOUSE_REPEAT_R,
        EV_MOUSE_HOLD_M,
        EV_MOUSE_PRESS_M,
        EV_MOUSE_DRAG_M,
        EV_MOUSE_RELEASE_M,
        EV_MOUSE_DCLICK_M,
        EV_MOUSE_REPEAT_M,

        EV_TOP,
        EV_BOTTOM,

        EV_BUMP_RIGHT,
        EV_BUMP_LEFT,
        EV_JOIN_RIGHT,
        EV_JOIN_LEFT,
        EV_SPLIT,
        EV_SCROLL_LINE_UP,
        EV_SCROLL_LINE_DOWN,
        EV_SCROLL_PAGE_UP,
        EV_SCROLL_PAGE_DOWN,
        EV_SCROLL_LEFT_FIELD,
        EV_SCROLL_RIGHT_FIELD,
        EV_SCROLL_LEFT_PAGE,
        EV_SCROLL_RIGHT_PAGE,
        EV_SCROLL_VERTICAL,
        EV_SCROLL_HORIZONTAL,

        EV_IDLE,
        EV_BUFFER_CLEAR,

        EV_MOUSE_MOVE,
        EV_LIST_BOX_CHANGED,
        EV_MENU_ACTIVE,
        EV_MENU_INITPOPUP,
        EV_LIST_BOX_DCLICK,
        EV_LIST_BOX_CLOSED,
        EV_BACKGROUND_RESIZE,

        // NOTE: This event should always be passed up, from all functions.
        EV_KILL_UI,

        EV_CHECK_BOX_CLICK,
        EV_REDRAW_SCREEN,

        EV_LAST_PLUS_1,
        EV_LAST_ENUMERATED              = EV_LAST_PLUS_1-1,

        EV_FIRST_UNUSED                 = 0x400
};

/*
 * The following section provides compatibility with earlier UI based
 * programs which may have relied on these names. The names have been
 * changed for consistency.
 */

#define EV_CTRL_LEFT            EV_CTRL_CURSOR_LEFT
#define EV_CTRL_RIGHT           EV_CTRL_CURSOR_RIGHT
#define EV_CTRL_UP              EV_CTRL_CURSOR_UP
#define EV_CTRL_DOWN            EV_CTRL_CURSOR_DOWN

#define EV_CTRL_PGUP            EV_CTRL_PAGE_UP
#define EV_CTRL_PGDN            EV_CTRL_PAGE_DOWN
#define EV_ALT_PGUP             EV_ALT_PAGE_UP
#define EV_ALT_PGDN             EV_ALT_PAGE_DOWN

#define         MAX_EVENT_LISTS         30

typedef struct eventlist {
        int             num_lists;
        EVENT _FARD*    events[ MAX_EVENT_LISTS ];
} EVENTLIST;

enum    {
        ATTR_MENU,
        ATTR_ACTIVE,
        ATTR_CURR_ACTIVE,
        ATTR_INACTIVE,
        ATTR_CURR_INACTIVE,
        ATTR_SHADOW,
        ATTR_DEFAULT_HOTSPOT,
        ATTR_NORMAL,
        ATTR_BRIGHT,
        ATTR_EDIT,
        ATTR_REVERSE,
        ATTR_EDIT2,
        ATTR_HOTSPOT,
        ATTR_HELP,
        ATTR_HOT,
        ATTR_HOT_CURR,
        ATTR_HOT_QUIET,
        ATTR_CURR_EDIT,
        ATTR_CURR_MARK_EDIT,
        ATTR_MARK_NORMAL,
        ATTR_MARK_EDIT,
        ATTR_CURR_HOTSPOT_KEY,
        ATTR_EDIT_DIAL,
        ATTR_UNUSED3,
        ATTR_UNUSED4,
        ATTR_CURR_SELECT_DIAL,
        ATTR_FRAME,
        ATTR_SCROLL_ICON,
        ATTR_SCROLL_BAR,
        ATTR_DIAL_FRAME,
        ATTR_BROWSE,
        ATTR_CURR_HOTSPOT,
        ATTR_ERROR,
        ATTR_HINT,
        ATTR_WARNING,
        ATTR_OFF_HOTSPOT,
        ATTR_RADIO_HOTSPOT,
        ATTR_LAST
};

/* line drawing and graphics characters */
enum {
        /* single line box drawing */
        UI_LLCORNER = 1,
        UI_LRCORNER,
        UI_ULCORNER,
        UI_URCORNER,
        UI_HLINE,
        UI_VLINE,
        UI_TTEE,
        UI_RTEE,
        UI_LTEE,

        /* double line box drawing */
        UI_DLLCORNER,
        UI_DLRCORNER,

⌨️ 快捷键说明

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