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: DtEditor.hh /main/9 1998/02/03 10:28:23 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.
46 // Include the DtWidgetEditor .h file given by HP.
48 #include <Dt/Editor.h>
51 #include "DtMailEditor.hh"
53 class CDEM_DtWidgetEditor : public Editor
59 DtMailEditor *owner_of_editor);
60 ~CDEM_DtWidgetEditor();
62 // Pure virtual functions of class Editor
64 virtual void initialize();
66 virtual void set_contents(
68 const unsigned long len
71 virtual void set_contents(const char *path);
73 virtual char* get_contents();
75 virtual void append_to_contents(
76 const char *new_contents,
77 const unsigned long len
80 virtual void append_to_contents(const char *path);
82 virtual void append_at_cursor(const char *path);
84 virtual void append_at_cursor(
86 const unsigned long len
89 virtual void clear_contents();
90 virtual int no_text();
92 virtual Widget get_text_widget();
93 virtual Pixel get_text_foreground();
94 virtual Pixel get_text_background();
95 virtual Dimension get_text_width();
96 virtual XmFontList get_text_fontList();
97 virtual Widget get_editor();
99 virtual int get_columns();
100 virtual int get_rows();
101 virtual void set_columns(int ncolumns);
102 virtual void set_editable(Boolean value);
103 virtual void set_rows(int nrows);
105 virtual void auto_show_cursor_off();
106 virtual void auto_show_cursor_restore();
108 virtual void set_to_top();
109 virtual void set_to_bottom();
111 virtual void cut_selection();
112 virtual void copy_selection();
113 virtual void paste_from_clipboard();
114 virtual void paste_special_from_clipboard(Editor::InsertFormat);
115 virtual void clear_selection();
116 virtual void delete_selection();
117 virtual void select_all();
119 virtual void disable_redisplay();
120 virtual void enable_redisplay();
123 // End of Pure virtual functions for class Editor.
125 // Pure virtual functions of class AbstractEditorParent
126 virtual void text_selected();
127 virtual void text_unselected();
129 // Functions specific to DtEditor
130 virtual void set_word_wrap(Boolean value);
131 virtual void undo_edit();
132 virtual void find_change();
133 virtual void spell();
134 virtual void format();
136 static void MenuButtonHandler(Widget, XtPointer, XEvent *, Boolean *);
140 // modify verify callback used during Paste Special
141 static void modify_verify_callback(Widget, XtPointer, XtPointer);
143 static void text_selected_callback(Widget, void *, void *);
144 static void text_unselected_callback(Widget, void *, void *);
148 struct PSClientData {
149 CDEM_DtWidgetEditor *obj;
150 Editor::InsertFormat insert_format;
152 XmTextBlockRec *_modified_text;
153 size_t _modified_text_buflen;
154 enum PasteSpecBuf { MAXBUFSZ = 2048, BUFINC = 512};
155 void modifyData(char *, int, Editor::InsertFormat);
156 void reallocPasteBuf(size_t size_req) {
157 _modified_text->ptr =
158 (char *)realloc((void *)_modified_text->ptr, size_req);
159 _modified_text_buflen = size_req;
162 const char *indent_str;
163 const char *begin_ins_bracket;
164 const char *end_ins_bracket;
170 DtMailEditor *my_owner;
171 Boolean text_already_selected;
172 Boolean _auto_show_cursor;
175 unsigned long _buf_len;
179 #endif // DTEDITOR_HH