From 367f908d8ed5a3464b9676223a26ddf4e11bdb5b Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 7 Jan 1999 16:36:11 +0000 Subject: "Final" changes for first draft of 1.0 documentation. git-svn-id: file:///fltk/svn/fltk/trunk@187 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/events.html | 572 ++++++++++++---------------------------------- 1 file changed, 149 insertions(+), 423 deletions(-) (limited to 'documentation/events.html') diff --git a/documentation/events.html b/documentation/events.html index b4b5f1513..c4bc8c052 100644 --- a/documentation/events.html +++ b/documentation/events.html @@ -1,499 +1,225 @@ -

4 - Handling Events

+

6 - Handling Events

This chapter discusses the FLTK event model and how to handle events in your program or widget.

The FLTK Event Model

-

Mouse Events

- -

FL_PUSH

- -

FL_RELEASE

- -

FL_DRAG

- -

FL_MOVE

- -

Keyboard Events

- -

FL_KEYBOARD

- -

FL_SHORTCUT

- -

Widget Events

- -

FL_ACTIVATE

- -

FL_DEACTIVATE

- -

FL_HIDE

- -

FL_SHOW

- -

FL_FOCUS

- -

FL_UNFOCUS

+Events are identified the small integer argument passed to the Fl_Widget::handle() virtual method. Other +information about the most recent event is stored in static locations +and acquired by calling the Fl::event_*() methods. This static +information remains valid until the next event is read from window +system (i.e. it is ok to look at it outside of the handle() method). -

FL_ENTER

- -

FL_LEAVE

- -

FL_PASTE

- -

FL_SELECTIONCLEAR

- - - -Events in Fltk - -

Events in Fltk

- -

Events are identified the small integer argument passed to the Fl_Widget::handle() virtual method. -Other information about the most recent event is stored in static -locations and aquired by calling Fl::event_*(). This static -information remains valid until the next event is read from the X -server (that is, it is ok to look at it outside the handle() method). +

Mouse Events

-

FL_PUSH (1)

FL_DRAG (5)

FL_RELEASE (2)

FL_ENTER (3)

FL_MOVE (10)

FL_LEAVE (4)

FL_FOCUS (6)

FL_UNFOCUS (7)

FL_KEYBOARD (8)

FL_SHORTCUT (11)

FL_DEACTIVATE (13)

FL_ACTIVATE (14)

FL_HIDE (15)

FL_SHOW (16)

FL_PASTE (17)

FL_SELECTIONCLEAR (18)

- - -

Fl::event_*() methods

+

Fl::event_*() methods

-Fltk keeps the information about the most recent event in static +FLTK keeps the information about the most recent event in static storage. This information is good until the next event is processed. -Thus it is valid inside handle() and callback() methods. +Thus it is valid inside handle() and callback() methods.

These are all trivial inline functions and thus very fast and -small. The data is stored in static locations and remains valid until -the next X event is handled. - - -

int Fl::event_button();

int Fl::event_x() -
int Fl::event_y()

int Fl::event_x_root() -
int Fl::event_y_root()

void Fl::get_mouse(int &,int &)

ulong Fl::event_state(); -
unsigned int Fl::event_state(int);

int Fl::event_key(); -
int Fl::event_key(int); -
int Fl::get_key(int);

char * Fl::event_text()

char * Fl::event_length()

int Fl::event_is_click()

void Fl::event_is_click(0)

int Fl::event_clicks()

void Fl::event_clicks(int)

int Fl::event_inside(const Fl_Widget *) const ; -
int Fl::event_inside(int,int,int,int);

int Fl::test_shortcut(ulong) const ;

Fl_Widget *Fl::focus() const; -
void Fl::focus(Fl_Widget *);

int Fl_Widget::take_focus();

Fl_Widget *Fl::belowmouse() const; -
void Fl::belowmouse(Fl_Widget *);

Fl_Widget *Fl::pushed() const; -
void Fl::pushed(Fl_Widget *);

void Fl::add_handler(int (*f)(int));