syncing wtextfield.c
[wmaker-crm.git] / src / text.h
blobe287a81a79d0223dbb123c17e44b1fd871f9546e
1 /********************************************************************\
2 * text.h -- a basic text field *
3 * Copyright (C) 1997 Robin D. Clark *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation; either version 2 of *
8 * the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License*
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
18 * *
19 * Author: Rob Clark *
20 * Internet: rclark@cs.hmc.edu *
21 * Address: 609 8th Street *
22 * Huntington Beach, CA 92648-4632 *
23 \********************************************************************/
25 #ifndef __TEXT_H__
26 #define __TEXT_H__
28 #include "wcore.h"
30 typedef struct {
31 char *txt; /* ptr to the text */
32 int length; /* length of txt[] */
33 int startPos; /* beginning of selected text */
34 int endPos; /* end of selected text */
35 } WTextBlock; /* if startPos == endPos, no txt *
36 * is selected... they give the *
37 * cursor position. */
38 typedef struct {
39 WCoreWindow *core;
40 WMFont *font;
41 WTextBlock text;
42 GC gc;
43 GC regGC; /* the normal GC */
44 GC invGC; /* inverted, for selected text */
45 WMagicNumber *magic;
46 short xOffset;
47 short yOffset;
48 unsigned int done:1;
49 unsigned int blink_on:1;
50 unsigned int blinking:1;
51 unsigned int canceled:1;
52 } WTextInput;
55 /** PROTOTYPES ******************************************************/
56 WTextInput* wTextCreate( WCoreWindow *core, int x, int y, int width,
57 int height );
58 void wTextDestroy( WTextInput *wText );
59 void wTextPaint( WTextInput *wText );
60 char* wTextGetText( WTextInput *wText );
61 void wTextPutText( WTextInput *wText, char *txt );
62 void wTextInsert( WTextInput *wText, char *txt );
63 void wTextSelect( WTextInput *wText, int start, int end );
64 void wTextRefresh( WTextInput *wText );
66 #endif