- Main Page
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# KrTextWidget Class Reference

A "widget" version the the textbox. More...

`#include <textwidget.h>`

Inheritance diagram for KrTextWidget:

List of all members.

## Public Member Functions
| KrTextWidget (int capacity, int width, int height, bool drawBorder, bool drawBackground, bool editable, const KrScheme &scheme)
| A rather feature rich constructor.
virtual int | IsMouseListener ()
| IsMouseListener returns whether this is a mouse listener or not, and which buttons are listened to.
virtual void | MouseIn (bool down, bool in)
virtual void | MouseMove (bool down, int x, int y)
virtual bool | MouseClick (int down, int x, int y)
void | SetTextChar (const std::string &)
| Set the text of the box.
void | GetTextChar (std::string *buffer)
| Get the text of the box to the given string.

## Detailed Description

A "widget" version the the textbox.

The regular textbox (KrTextBox) can be used to display dynamic, but not editable text. The widget version can be editable, and integrated with the widget event system.

Events Sent

- ACTIVATED when the 'return' key is pressed.
- SELECTION when it gets or loses focus.

## Constructor & Destructor Documentation

KrTextWidget::KrTextWidget | ( | int | capacity,
|  | int | width,
|  | int | height,
|  | bool | drawBorder,
|  | bool | drawBackground,
|  | bool | editable,
|  | const KrScheme & | scheme |
| ) |  |  |

A rather feature rich constructor.

Parameters:

  | drawBorder | Draw a square outline arount the text box.
  | drawBackground | Fill in the box behind the text. If false, transparent.
  | editable | If the textbox should support a cursor and keyboard editing.
  | scheme | Provieds the color palette and font for this textbox.

## Member Function Documentation

virtual int KrTextWidget::IsMouseListener | ( |  | ) | `[inline, virtual]`

IsMouseListener returns whether this is a mouse listener or not, and which buttons are listened to.

A return value of 0 is no listening. Else it can return an OR mask of the buttons ( LEFT_MOUSE, RIGHT_MOUSE, MIDDLE_MOUSE ) it wants to listen for mouse clicks.

The simple case is to only listen to the left mouse, in which case return LEFT_MOUSE (1). The click messages can then be treated like a boolean for the left mouse (1 is down, 0 is up.)

Currently, with version 2.0, only the LEFT_MOUSE is supported.

MouseIn is called when a mouse moves in to the widget. The 'down' parameter reflects the state of the left mouse button. The 'in' reflects whether it is moving to the widget (true) or away from the widget (false).

MouseMove reports when the mouse moves over this widget.

MouseClick is called when the mouse is clicked on this widget. The 'click' param will have a single value (not OR mask) of LEFT_UP, LEFT_DOWN, RIGHT_UP, etc. with x and y coordinates of the action.

In the simple case that you are only listening to the left mouse, the parameter will be essentially a boolean: 1 for the left mouse down, 0 for the left mouse up.

Reimplemented from KrWidget.

virtual bool KrTextWidget::MouseClick | ( | int | down,
|  | int | x,
|  | int | y |
| ) |  |  | `[virtual]`

See also:
  IsMouseListener

Reimplemented from KrWidget.

virtual void KrTextWidget::MouseIn | ( | bool | down,
|  | bool | in |
| ) |  |  | `[virtual]`

See also:
  IsMouseListener

Reimplemented from KrWidget.

virtual void KrTextWidget::MouseMove | ( | bool | down,
|  | int | x,
|  | int | y |
| ) |  |  | `[inline, virtual]`

See also:
  IsMouseListener

Reimplemented from KrWidget.

The documentation for this class was generated from the following file:

- textwidget.h