2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
26 * $TOG: XmTextEditor.h /main/9 1998/02/03 10:30:08 mgreess $
28 * RESTRICTED CONFIDENTIAL INFORMATION:
30 * The information in this document is subject to special
31 * restrictions in a confidential disclosure agreement between
32 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
33 * document outside HP, IBM, Sun, USL, SCO, or Univel without
34 * Sun's specific written approval. This document and all copies
35 * and derivative works thereof must be returned or destroyed at
38 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 #ifndef XMTEXT_EDITOR_H
44 #define XMTEXT_EDITOR_H
46 #include "DtMailEditor.hh"
49 class XmTextEditor : public Editor
53 XmTextEditor(Widget parent, DtMailEditor *owner);
56 virtual void initialize();
58 virtual void set_contents(
60 const unsigned long len
63 virtual void set_contents(const char * path);
65 virtual char * get_contents();
67 virtual void append_to_contents(
68 const char *new_contents,
69 const unsigned long len
72 virtual void append_to_contents(const char * path);
74 virtual void append_at_cursor(const char *path);
75 virtual void append_at_cursor(
77 const unsigned long len
80 virtual void clear_contents();
82 virtual Widget get_text_widget();
84 virtual Pixel get_text_foreground();
85 virtual Pixel get_text_background();
86 virtual XmFontList get_text_fontList();
87 virtual Dimension get_text_width();
89 virtual Widget get_editor();
91 virtual int get_columns();
92 virtual int get_rows();
93 virtual void set_columns(int ncolumns);
94 virtual void set_editable(Boolean value);
95 virtual void set_rows(int nrows);
97 virtual void auto_show_cursor_off();
98 virtual void auto_show_cursor_restore();
99 virtual void set_to_top();
100 virtual void set_to_bottom();
102 virtual void obtained_focus();
103 virtual void text_selected();
104 virtual void text_unselected();
106 virtual int no_text();
108 virtual void find_change();
109 virtual void spell();
110 virtual void format();
111 virtual void set_word_wrap(Boolean value);
112 virtual void undo_edit();
113 virtual void cut_selection();
114 virtual void copy_selection();
115 virtual void paste_from_clipboard();
116 virtual void paste_special_from_clipboard(Editor::InsertFormat);
117 virtual void clear_selection();
118 virtual void delete_selection();
119 virtual void select_all();
120 virtual void disable_redisplay();
121 virtual void enable_redisplay();
123 static void MenuButtonHandler(Widget, XtPointer, XEvent *, Boolean *);
126 // modify verify callback used during Paste Special
127 static void modify_verify_callback(Widget, XtPointer, XtPointer);
128 static void text_selected_callback(
133 static void text_unselected_callback(
139 static void focus_callback(
144 #endif /* DEAD_WOOD */
147 struct PSClientData {
149 Editor::InsertFormat insert_format;
151 XmTextBlockRec *_modified_text;
152 size_t _modified_text_buflen;
153 enum PasteSpecBuf { MAXBUFSZ = 2048, BUFINC = 512};
154 void modifyPasteData(XmTextVerifyCallbackStruct *, Editor::InsertFormat);
155 void reallocPasteBuf(size_t size_req) {
156 _modified_text->ptr =
157 (char *)realloc((void *)_modified_text->ptr, size_req);
158 _modified_text_buflen = size_req;
160 const char *indent_str;
161 const char *begin_ins_bracket;
162 const char *end_ins_bracket;
165 DtMailEditor *my_owner;
166 Boolean text_already_selected;
168 void loadFile(const char * path, const int pos);
171 unsigned long _buf_len;
172 Boolean _auto_show_cursor;
175 #endif // XMTEXT_EDITOR_HH