1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
#ifndef CDKINCLUDES
#ifndef CURDEF_H
#define CURDEF_H
#ifndef CDK_H
#define CDKINCLUDES
#include <cdk.h>
#undef CDKINCLUDES
#endif
/*
* $Id: curdefs.h,v 1.17 2009/02/16 00:33:50 tom Exp $
*
* Copyright 1999-2004,2009 Thomas E. Dickey
* Copyright 1999, Mike Glover
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, distribute with
* modifications, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above copyright
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
*/
/*
* This header file adds some useful curses-style definitions.
*/
#undef CTRL
#define CTRL(c) ((c)&0x1f)
#undef CDK_REFRESH
#define CDK_REFRESH CTRL('L')
#undef CDK_PASTE
#define CDK_PASTE CTRL('V')
#undef CDK_COPY
#define CDK_COPY CTRL('Y')
#undef CDK_ERASE
#define CDK_ERASE CTRL('U')
#undef CDK_CUT
#define CDK_CUT CTRL('X')
#undef CDK_BEGOFLINE
#define CDK_BEGOFLINE CTRL('A')
#undef CDK_ENDOFLINE
#define CDK_ENDOFLINE CTRL('E')
#undef CDK_BACKCHAR
#define CDK_BACKCHAR CTRL('B')
#undef CDK_FORCHAR
#define CDK_FORCHAR CTRL('F')
#undef CDK_TRANSPOSE
#define CDK_TRANSPOSE CTRL('T')
#undef CDK_NEXT
#define CDK_NEXT CTRL('N')
#undef CDK_PREV
#define CDK_PREV CTRL('P')
#undef SPACE
#define SPACE ' '
#undef DELETE
#define DELETE '\177' /* Delete key */
#undef TAB
#define TAB '\t' /* Tab key. */
#undef KEY_ESC
#define KEY_ESC '\033' /* Escape Key. */
#undef KEY_RETURN
#define KEY_RETURN '\012' /* Return key */
#undef KEY_TAB
#define KEY_TAB '\t' /* Tab key */
#undef KEY_F1
#define KEY_F1 KEY_F(1)
#undef KEY_F2
#define KEY_F2 KEY_F(2)
#undef KEY_F3
#define KEY_F3 KEY_F(3)
#undef KEY_F4
#define KEY_F4 KEY_F(4)
#undef KEY_F5
#define KEY_F5 KEY_F(5)
#undef KEY_F6
#define KEY_F6 KEY_F(6)
#undef KEY_F7
#define KEY_F7 KEY_F(7)
#undef KEY_F8
#define KEY_F8 KEY_F(8)
#undef KEY_F9
#define KEY_F9 KEY_F(9)
#undef KEY_F10
#define KEY_F10 KEY_F(10)
#undef KEY_F11
#define KEY_F11 KEY_F(11)
#undef KEY_F12
#define KEY_F12 KEY_F(12)
#define KEY_ERROR ((chtype)ERR)
/* these definitions may work for antique versions of curses */
#if !defined(HAVE_GETBEGYX) && !defined(getbegyx)
#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
#endif
#if !defined(HAVE_GETMAXYX) && !defined(getmaxyx)
#define getmaxyx(win,y,x) (y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR)
#endif
/* these definitions may be needed for bleeding-edge curses implementations */
#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY))
#undef getbegx
#undef getbegy
#define getbegx(win) cdk_getbegx(win)
#define getbegy(win) cdk_getbegy(win)
extern int cdk_getbegx(WINDOW *);
extern int cdk_getbegy(WINDOW *);
#endif
#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY))
#undef getmaxx
#undef getmaxy
#define getmaxx(win) cdk_getmaxx(win)
#define getmaxy(win) cdk_getmaxy(win)
extern int cdk_getmaxx(WINDOW *);
extern int cdk_getmaxy(WINDOW *);
#endif
/*
* Derived macros
*/
#define getendx(a) (getbegx(a) + getmaxx(a))
#define getendy(a) (getbegy(a) + getmaxy(a))
#endif /* CURDEF_H */
#endif /* CDKINCLUDES */
|