1. Fl::run() in Fl.cxx
  2. Fl::wait() in Fl.cxx
    這裏會先處理 timer 的機制,時間到先執行 timer 函數,再去執行 fl_wait。
  3. fl_wait() in Fl_x.cxx
  4. do_queued_events() in Fl_x.cxx
  5. fl_handle() in Fl_x.cxx
  6. Fl::handle in Fl.cxx
    其它自定的 event 會利用 send 函數,將 event 傳到 Widget 元件的 handle 函數。
  7. send_handlers in Fl.cxx
  8. hl->handle() in every class
  • 在 class Fl_Widget 內有 virtual int handle(int); 可供子類別重寫。
  • 在 Fl::handle 中有FL_PUSH,FL_MOVE,FL_DRAG,FL_RELEASE,FL_KEYBOARD,FL_SHORTCUT,FL_MOUSEWHEEL 利用 send 函數,將 event 傳到 Widget 元件的 handle 函數。
  • 在 Fl::handle 中只有 FL_CLOSE 及 FL_SHORTCUT(FL_Escape) 才會執行 do_callback()。
    另外在某些類別會改寫 handle 函數,在裏面會呼叫 do_callback()。
    可以利用 callback(Fl_Callback* c) 函數來設定 do_callback() 函數。
  • 在 Fl::handle 中只有 FL_RELEASE,FL_UNFOCUS,FL_FOCUS,FL_ENTER,FL_LEAVE 會呼叫 fl_fix_focus 來觸發 handle 的執行。
    --> w->handle(Fl::e_number = FL_ENTER);
    --> w->handle(Fl::e_number = FL_MOVE);
  • ...
  • ...
  • ...
  • ...

Events are identified by an Fl_Event enumeration value. The following events are currently defined:
· FL_NO_EVENT - No event (or an event fltk does not understand) occurred (0).
· FL_PUSH - A mouse button was pushed.
inline int fl_mouse_button() {return Fl::event_button();}
#define fl_mousebutton fl_mouse_button
// Fl::event_button():
#define FL_LEFT_MOUSE 1
#define FL_MIDDLE_MOUSE 2
#define FL_RIGHT_MOUSE 3
· FL_RELEASE - A mouse button was released.
· FL_ENTER - The mouse pointer entered a widget.
· FL_LEAVE - The mouse pointer left a widget.
· FL_DRAG - The mouse pointer was moved with a button pressed.
· FL_FOCUS - A widget should receive keyboard focus.
· FL_UNFOCUS - A widget loses keyboard focus.
· FL_KEYBOARD - A key was pressed.
· FL_CLOSE - A window was closed.
· FL_MOVE - The mouse pointer was moved with no buttons pressed.
· FL_SHORTCUT - The user pressed a shortcut key.
· FL_DEACTIVATE - The widget has been deactivated.
· FL_ACTIVATE - The widget has been activated.
· FL_HIDE - The widget has been hidden.
· FL_SHOW - The widget has been shown.
· FL_PASTE - The widget should paste the contents of the clipboard.
· FL_SELECTIONCLEAR - The widget should clear any selections made for the clipboard.
· FL_MOUSEWHEEL - The horizontal or vertical mousewheel was turned.
Fl::e_dy = -1; // Up
Fl::e_dy = +1; // Down
· FL_DND_ENTER - The mouse pointer entered a widget dragging data.
· FL_DND_DRAG - The mouse pointer was moved dragging data.
· FL_DND_LEAVE - The mouse pointer left a widget still dragging data.
· FL_DND_RELEASE - Dragged data is about to be dropped.
enum Fl_Event { // events in Enumerations.h
FL_NO_EVENT = 0,
FL_PUSH = 1,
FL_RELEASE = 2,
FL_ENTER = 3,
FL_LEAVE = 4,
FL_DRAG = 5,
FL_FOCUS = 6,
FL_UNFOCUS = 7,
FL_KEYDOWN = 8,
FL_KEYUP = 9,
FL_CLOSE = 10,
FL_MOVE = 11,
FL_SHORTCUT = 12,
FL_DEACTIVATE = 13,
FL_ACTIVATE = 14,
FL_HIDE = 15,
FL_SHOW = 16,
FL_PASTE = 17,
FL_SELECTIONCLEAR = 18,
FL_MOUSEWHEEL = 19,
FL_DND_ENTER = 20,
FL_DND_DRAG = 21,
FL_DND_LEAVE = 22,
FL_DND_RELEASE = 23
};
#define FL_KEYBOARD FL_KEYDOWN
創作者介紹

邱小新の工作筆記

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()