UNIXworkcode

1 /* 2 * Copyright 2020 Olaf Wintermann 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 * DEALINGS IN THE SOFTWARE. 21 */ 22 23 #ifndef XNE_TEXTFIELD_H 24 #define XNE_TEXTFIELD_H 25 26 27 #ifndef DISABLE_XNE_TEXTFIELD 28 #define XNEtextfieldWidgetClass textfieldWidgetClass 29 30 #define XNECreateText(parent,name,args,count) XNECreateTextField(parent,name,args,count) 31 #define XNETextSetString(widget,value) XNETextFieldSetString(widget,value) 32 #define XNETextGetString(widget) XNETextFieldGetString(widget) 33 #define XNETextGetLastPosition(widget) XNETextFieldGetLastPosition(widget) 34 #define XNETextSetInsertionPosition(widget, i) XNETextFieldSetInsertionPosition(widget, i) 35 #define XNETextGetLastPosition(widget) XNETextFieldGetLastPosition(widget) 36 #define XNETextSetSelection(w, f, l, t) XNETextFieldSetSelection(w, f, l, t) 37 #else 38 #define XNEtextfieldWidgetClass xmTextFieldWidgetClass 39 40 #define XNECreateText(parent,name,args,count) XmCreateTextField(parent,name,args,count) 41 #define XNETextSetString(widget,value) XmTextFieldSetString(widget,value) 42 #define XNETextGetString(widget) TextGetStringUtf8(widget) 43 #define XNETextGetLastPosition(widget) XmTextFieldGetLastPosition(widget) 44 #define XNETextSetInsertionPosition(widget, i) XmTextFieldSetInsertionPosition(widget, i) 45 #define XNETextSetSelection(w, f, l, t) XmTextFieldSetSelection(w, f, l, t) 46 #endif 47 48 #include <X11/Intrinsic.h> 49 #include <Xm/TextF.h> 50 #include "../source/text.h" /* textNXftFont */ 51 52 extern WidgetClass textfieldWidgetClass; 53 54 struct TextFieldClassRec; 55 struct TextFieldRec; 56 57 typedef struct TextFieldRec *TextFieldWidget; 58 59 60 void textfield_init(Widget request, Widget neww, ArgList args, Cardinal *num_args); 61 void textfield_realize(Widget widget, XtValueMask *mask, XSetWindowAttributes *attributes); 62 void textfield_destroy(Widget widget); 63 void textfield_resize(Widget widget); 64 void textfield_expose(Widget widget, XEvent* event, Region region); 65 Boolean textfield_set_values(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args); 66 Boolean textfield_acceptfocus(Widget widget, Time *time); 67 68 void textfield_recalc_size(TextFieldWidget w); 69 70 void XNETextFieldSetString(Widget widget, char *value); 71 char* XNETextFieldGetString(Widget widget); 72 XmTextPosition XNETextFieldGetLastPosition(Widget widget); 73 void XNETextFieldSetInsertionPosition(Widget widget, XmTextPosition i); 74 void XNETextFieldSetSelection(Widget w, XmTextPosition first, XmTextPosition last, Time sel_time); 75 76 77 #endif /* XNE_TEXTFIELD_H */ 78 79