| 1 |
/* wtext.h -*- C++ -*- |
| 2 |
$Id: wtext.h,v 1.4 1997/10/18 04:57:46 elf Exp $ |
| 3 |
|
| 4 |
written by Marc Singer |
| 5 |
27 May 1997 |
| 6 |
|
| 7 |
This file is part of the project XO. See the file README for |
| 8 |
more information. |
| 9 |
|
| 10 |
Copyright (C) 1997 Marc Singer |
| 11 |
|
| 12 |
This program is free software; you can redistribute it and/or |
| 13 |
modify it under the terms of the GNU General Public License as |
| 14 |
published by the Free Software Foundation; either version 2 of the |
| 15 |
License, or (at your option) any later version. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, but |
| 18 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 20 |
General Public License for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License |
| 23 |
in a file called COPYING along with this program; if not, write to |
| 24 |
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA |
| 25 |
02139, USA. |
| 26 |
|
| 27 |
----------- |
| 28 |
DESCRIPTION |
| 29 |
----------- |
| 30 |
*/ |
| 31 |
|
| 32 |
#if !defined (__WTEXT_H__) |
| 33 |
# define __WTEXT_H__ |
| 34 |
|
| 35 |
/* ----- Includes */ |
| 36 |
|
| 37 |
|
| 38 |
/* ----- Classes */ |
| 39 |
|
| 40 |
class WTextEdit : public LWindow { |
| 41 |
|
| 42 |
protected: |
| 43 |
Font m_fid; |
| 44 |
unsigned long m_foreground; // Color values for foreground and |
| 45 |
unsigned long m_background; // background pixels |
| 46 |
unsigned long m_highlight; // Highlight for pressed button |
| 47 |
char* m_sz; // String of characters in buffer |
| 48 |
int m_cchLim; // Length of current string |
| 49 |
int m_cchMax; // Length of allocated text buffer |
| 50 |
int m_widthString; // Length of last rendered string |
| 51 |
Pixmap m_pixmapCaret; // Bitmap representing the caret. |
| 52 |
bool m_fFocus; // Window has focus |
| 53 |
|
| 54 |
public: |
| 55 |
void buttondown (XButtonEvent* pEvent); |
| 56 |
void buttonup (XButtonEvent* pEvent); |
| 57 |
void expose (XExposeEvent* pEvent); |
| 58 |
void createself (XoCreateSelfWindowEvent* pEvent); |
| 59 |
void enter (XEnterWindowEvent* pEvent); |
| 60 |
void leave (XLeaveWindowEvent* pEvent); |
| 61 |
void keypress (XKeyPressedEvent* pEvent); |
| 62 |
void keyrelease (XKeyReleasedEvent* pEvent); |
| 63 |
void focusin (XFocusInEvent* pEvent); |
| 64 |
void focusout (XFocusOutEvent* pEvent); |
| 65 |
|
| 66 |
public: |
| 67 |
WTextEdit (LDisplay* pDisplay) : LWindow (pDisplay) { |
| 68 |
zero (); m_cbInstance = sizeof (*this) - sizeof (LWindow); } |
| 69 |
WTextEdit (LWindow* pWindow) : LWindow (pWindow) {} |
| 70 |
~WTextEdit () { |
| 71 |
release_this (); } |
| 72 |
void release_this (void) {} |
| 73 |
void zero (void) { |
| 74 |
memset (((LWindow*) this) + 1, 0, sizeof (*this) - sizeof (LWindow)); } |
| 75 |
|
| 76 |
static void register_template (LDisplay* pDisplay); |
| 77 |
|
| 78 |
// -- Control Methods |
| 79 |
const char* text (void) { |
| 80 |
return m_sz; } |
| 81 |
void text (const char* sz); |
| 82 |
|
| 83 |
}; |
| 84 |
|
| 85 |
|
| 86 |
/* ----- Globals */ |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
#endif /* __WTEXT_H__ */ |