Main Page - Header
Author: The Inti Development Team

Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# events.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002-2003 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    00004  *
    00005  *  This program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  This program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00024
    00025 #ifndef INTI_GDK_EVENTS_H
    00026 #define INTI_GDK_EVENTS_H
    00027
    00028 #ifndef INTI_G_BOXED_H
    00029 #include <inti/glib/boxed.h>
    00030 #endif
    00031
    00032 #ifndef INTI_GDK_TYPES_H
    00033 #include <inti/gdk/types.h>
    00034 #endif
    00035
    00036 #ifndef INTI_UTF_STRING_H
    00037 #include <inti/utf-string.h>
    00038 #endif
    00039
    00040 namespace Inti {
    00041
    00042 namespace Gdk {
    00043
    00044 class Device;
    00045 class Display;
    00046 class DragContext;
    00047 class EventAny;
    00048 class EventExpose;
    00049 class EventVisibility;
    00050 class EventMotion;
    00051 class EventButton;
    00052 class EventScroll;
    00053 class EventKey;
    00054 class EventCrossing;
    00055 class EventFocus;
    00056 class EventConfigure;
    00057 class EventProperty;
    00058 class EventSelection;
    00059 class EventProximity;
    00060 class EventClient;
    00061 class EventSetting;
    00062 class EventWindowState;
    00063 class EventDND;
    00064 class Keyval;
    00065 class Region;
    00066 class Screen;
    00067 class Window;
    00068
    00071
    00072 enum EventType
    00073 {
    00074         NOTHING = GDK_NOTHING,
    00076
    00077         DELETE = GDK_DELETE,
    00080
    00081         DESTROY = GDK_DESTROY,
    00083
    00084         EXPOSE = GDK_EXPOSE,
    00086
    00087         MOTION_NOTIFY = GDK_MOTION_NOTIFY,
    00089
    00090         BUTTON_PRESS = GDK_BUTTON_PRESS,
    00092
    00093         TWO_BUTTON_PRESS = GDK_2BUTTON_PRESS,
    00096
    00097         THREE_BUTTON_PRESS = GDK_3BUTTON_PRESS,
    00100
    00101         BUTTON_RELEASE = GDK_BUTTON_RELEASE,
    00103
    00104         KEY_PRESS = GDK_KEY_PRESS,
    00106
    00107         KEY_RELEASE = GDK_KEY_RELEASE,
    00109
    00110         ENTER_NOTIFY = GDK_ENTER_NOTIFY,
    00112
    00113         LEAVE_NOTIFY = GDK_LEAVE_NOTIFY,
    00115
    00116         FOCUS_CHANGE = GDK_FOCUS_CHANGE,
    00118
    00119         CONFIGURE = GDK_CONFIGURE,
    00122
    00123         MAP = GDK_MAP,
    00125
    00126         UNMAP = GDK_UNMAP,
    00128
    00129         PROPERTY_NOTIFY = GDK_PROPERTY_NOTIFY,
    00131
    00132         SELECTION_CLEAR = GDK_SELECTION_CLEAR,
    00134
    00135         SELECTION_REQUEST = GDK_SELECTION_REQUEST,
    00137
    00138         SELECTION_NOTIFY = GDK_SELECTION_NOTIFY,
    00140
    00141         PROXIMITY_IN = GDK_PROXIMITY_IN,
    00143
    00144         PROXIMITY_OUT = GDK_PROXIMITY_OUT,
    00146
    00147         DRAG_ENTER = GDK_DRAG_ENTER,
    00149
    00150         DRAG_LEAVE = GDK_DRAG_LEAVE,
    00152
    00153         DRAG_MOTION = GDK_DRAG_MOTION,
    00155
    00156         DRAG_STATUS = GDK_DRAG_STATUS,
    00158
    00159         DROP_START = GDK_DROP_START,
    00161
    00162         DROP_FINISHED = GDK_DROP_FINISHED,
    00164
    00165         CLIENT_EVENT = GDK_CLIENT_EVENT,
    00167
    00168         VISIBILITY_NOTIFY = GDK_VISIBILITY_NOTIFY,
    00170
    00171         NO_EXPOSE = GDK_NO_EXPOSE,
    00174
    00175         SCROLL = GDK_SCROLL,
    00177
    00178         WINDOW_STATE = GDK_WINDOW_STATE,
    00181
    00182         SETTING = GDK_SETTING
    00184 };
    00185
    00197
    00198 enum EventMask
    00199 {
    00200         EXPOSURE_MASK = GDK_EXPOSURE_MASK,
    00201         POINTER_MOTION_MASK = GDK_POINTER_MOTION_MASK,
    00202         POINTER_MOTION_HINT_MASK = GDK_POINTER_MOTION_HINT_MASK,
    00203         BUTTON_MOTION_MASK = GDK_BUTTON_MOTION_MASK,
    00204         BUTTON1_MOTION_MASK = GDK_BUTTON1_MOTION_MASK,
    00205         BUTTON2_MOTION_MASK = GDK_BUTTON2_MOTION_MASK,
    00206         BUTTON3_MOTION_MASK = GDK_BUTTON3_MOTION_MASK,
    00207         BUTTON_PRESS_MASK = GDK_BUTTON_PRESS_MASK,
    00208         BUTTON_RELEASE_MASK = GDK_BUTTON_RELEASE_MASK,
    00209         KEY_PRESS_MASK = GDK_KEY_PRESS_MASK,
    00210         KEY_RELEASE_MASK = GDK_KEY_RELEASE_MASK,
    00211         ENTER_NOTIFY_MASK = GDK_ENTER_NOTIFY_MASK,
    00212         LEAVE_NOTIFY_MASK = GDK_LEAVE_NOTIFY_MASK,
    00213         FOCUS_CHANGE_MASK = GDK_FOCUS_CHANGE_MASK,
    00214         STRUCTURE_MASK = GDK_STRUCTURE_MASK,
    00215         PROPERTY_CHANGE_MASK = GDK_PROPERTY_CHANGE_MASK,
    00216         VISIBILITY_NOTIFY_MASK = GDK_VISIBILITY_NOTIFY_MASK,
    00217         PROXIMITY_IN_MASK = GDK_PROXIMITY_IN_MASK,
    00218         PROXIMITY_OUT_MASK = GDK_PROXIMITY_OUT_MASK,
    00219         SUBSTRUCTURE_MASK = GDK_SUBSTRUCTURE_MASK,
    00220         SCROLL_MASK = GDK_SCROLL_MASK,
    00221         ALL_EVENTS_MASK = GDK_ALL_EVENTS_MASK
    00222 };
    00223
    00225
    00226 typedef unsigned int EventMaskField;
    00227
    00230
    00231 enum VisibilityState
    00232 {
    00233         VISIBILITY_UNOBSCURED = GDK_VISIBILITY_UNOBSCURED,
    00234         VISIBILITY_PARTIAL = GDK_VISIBILITY_PARTIAL,
    00235         VISIBILITY_FULLY_OBSCURED = GDK_VISIBILITY_FULLY_OBSCURED
    00236 };
    00237
    00240
    00241 enum ScrollDirection
    00242 {
    00243         SCROLL_UP = GDK_SCROLL_UP,
    00244         SCROLL_DOWN = GDK_SCROLL_DOWN,
    00245         SCROLL_LEFT = GDK_SCROLL_LEFT,
    00246         SCROLL_RIGHT = GDK_SCROLL_RIGHT
    00247 };
    00248
    00252
    00253 enum NotifyType
    00254 {
    00255         NOTIFY_ANCESTOR = GDK_NOTIFY_ANCESTOR,
    00257
    00258         NOTIFY_VIRTUAL = GDK_NOTIFY_VIRTUAL,
    00260
    00261         NOTIFY_INFERIOR = GDK_NOTIFY_INFERIOR,
    00263
    00264         NOTIFY_NONLINEAR = GDK_NOTIFY_NONLINEAR,
    00266
    00267         NOTIFY_NONLINEAR_VIRTUAL = GDK_NOTIFY_NONLINEAR_VIRTUAL,
    00271
    00272         NOTIFY_UNKNOWN = GDK_NOTIFY_UNKNOWN
    00274 };
    00275
    00278
    00279 enum CrossingMode
    00280 {
    00281         CROSSING_NORMAL = GDK_CROSSING_NORMAL,
    00282         CROSSING_GRAB = GDK_CROSSING_GRAB,
    00283         CROSSING_UNGRAB = GDK_CROSSING_UNGRAB
    00284 };
    00285
    00288
    00289 enum PropertyState
    00290 {
    00291         PROPERTY_NEW_VALUE = GDK_PROPERTY_NEW_VALUE,
    00292         PROPERTY_DELETE = GDK_PROPERTY_DELETE
    00293 };
    00294
    00297
    00298 enum WindowState
    00299 {
    00300         WINDOW_STATE_WITHDRAWN = GDK_WINDOW_STATE_WITHDRAWN,
    00301         WINDOW_STATE_ICONIFIED = GDK_WINDOW_STATE_ICONIFIED,
    00302         WINDOW_STATE_MAXIMIZED = GDK_WINDOW_STATE_MAXIMIZED,
    00303         WINDOW_STATE_STICKY = GDK_WINDOW_STATE_STICKY,
    00304         WINDOW_STATE_FULLSCREEN = GDK_WINDOW_STATE_FULLSCREEN
    00305 };
    00306
    00308
    00309 typedef unsigned int WindowStateField;
    00310
    00313
    00314 enum SettingAction
    00315 {
    00316         SETTING_ACTION_NEW = GDK_SETTING_ACTION_NEW,
    00317         SETTING_ACTION_CHANGED = GDK_SETTING_ACTION_CHANGED,
    00318         SETTING_ACTION_DELETED = GDK_SETTING_ACTION_DELETED
    00319 };
    00320
    00323
    00324 bool get_show_events();
    00326
    00327 bool events_pending();
    00330
    00331 void set_show_events(bool show_events);
    00337
    00339
    00346
    00347 class Event : public G::Boxed
    00348 {
    00349 protected:
    00350         Event();
    00351
    00352 public:
    00355
    00356         explicit Event(EventType type);
    00359
    00360         explicit Event(GdkEvent* event);
    00368
    00369         Event(GdkEvent* event, bool copy);
    00380
    00381         Event(const Event& src);
    00384
    00385         ~Event();
    00387
    00388         Event& operator=(const Event& src);
    00391
    00395
    00396         GdkEvent* gdk_event() const { return (GdkEvent*)boxed_; }
    00398
    00399         operator GdkEvent* () const;
    00401
    00402         EventType type() const;
    00404
    00405         EventAny* any() const;
    00407
    00408         EventExpose* expose() const;
    00410
    00411         EventVisibility* visibility() const;
    00414
    00415         EventMotion* motion() const;
    00418
    00419         EventButton* button() const;
    00422
    00423         EventScroll* scroll() const;
    00426
    00427         EventKey* key() const;
    00430
    00431         EventCrossing* crossing() const;
    00434
    00435         EventFocus* focus_change() const;
    00438
    00439         EventConfigure* configure() const;
    00442
    00443         EventProperty* property() const;
    00446
    00447         EventSelection* selection() const;
    00450
    00451         EventProximity* proximity() const;
    00454
    00455         EventClient* client() const;
    00458
    00459         EventSetting* setting() const;
    00462
    00463         EventWindowState* window_state() const;
    00466
    00467         EventDND* dnd() const;
    00470
    00471         unsigned int get_time() const;
    00476
    00477         bool get_state(ModifierTypeField *state) const;
    00485
    00486         bool get_axis(AxisUse axis_use, double *value) const;
    00491
    00492         bool get_coords(double *x_win, double *y_win) const;
    00497
    00498         bool get_root_coords(double *x_root, double *y_root) const;
    00503
    00504         Screen* get_screen() const;
    00511
    00513
    00514         static Pointer<Event> get();
    00518
    00519         static Pointer<EventExpose> get_graphics_expose(const Window& window);
    00525
    00526         static Pointer<Event> peek();
    00530
    00533
    00534         void put();
    00537
    00538         bool send_client_message(GdkNativeWindow winid, const Display *display = 0);
    00547
    00548         void send_clientmessage_toall();
    00556
    00557         void set_screen(Screen& screen);
    00560
    00562 };
    00563
    00569
    00570 class EventAny : public Event
    00571 {
    00572 public:
    00575
    00576         GdkEventAny* gdk_event_any() const { return (GdkEventAny*)boxed_; }
    00578
    00579         Window* window() const;
    00581
    00582         bool send_event() const;
    00584
    00586 };
    00587
    00595
    00596 class EventExpose : public EventAny
    00597 {
    00598 public:
    00601
    00602         GdkEventExpose* gdk_event_expose() const { return (GdkEventExpose*)boxed_; }
    00604
    00605         const Rectangle& area() const;
    00607
    00608         Pointer<Region> region() const;
    00610
    00611         int count() const;
    00616
    00618 };
    00619
    00626
    00627 class EventVisibility : public EventAny
    00628 {
    00629 public:
    00632
    00633         GdkEventVisibility* gdk_event_visibility() const { return (GdkEventVisibility*)boxed_; }
    00635
    00636         VisibilityState state() const;
    00638
    00640 };
    00641
    00648
    00649 class EventMotion : public EventAny
    00650 {
    00651 public:
    00654
    00655         GdkEventMotion* gdk_event_motion() const { return (GdkEventMotion*)boxed_; }
    00657
    00658         unsigned int time() const;
    00660
    00661         double x() const;
    00663
    00664         double y() const;
    00666
    00667         double* axes() const;
    00669
    00670         ModifierTypeField state() const;
    00673
    00674         bool is_hint() const;
    00676
    00677         Device* device() const;
    00679
    00680         double x_root() const;
    00682
    00683         double y_root() const;
    00685
    00687 };
    00688
    00721
    00722 class EventButton : public EventAny
    00723 {
    00724 public:
    00727
    00728         GdkEventButton* gdk_event_button() const { return (GdkEventButton*)boxed_; }
    00730
    00731         unsigned int time() const;
    00733
    00734         double x() const;
    00736
    00737         double y() const;
    00739
    00740         double* axes() const;
    00742
    00743         ModifierTypeField state() const;
    00746
    00747         unsigned int button() const;
    00752
    00753         Device* device() const;
    00755
    00756         double x_root() const;
    00758
    00759         double y_root() const;
    00761
    00763 };
    00764
    00773
    00774 class EventScroll : public EventAny
    00775 {
    00776 public:
    00779
    00780         GdkEventScroll* gdk_event_scroll() const { return (GdkEventScroll*)boxed_; }
    00782
    00783         unsigned int time() const;
    00785
    00786         double x() const;
    00788
    00789         double y() const;
    00791
    00792         ModifierTypeField state() const;
    00795
    00796         ScrollDirection direction() const;
    00798
    00799         Device* device() const;
    00801
    00802         double x_root() const;
    00804
    00805         double y_root() const;
    00807
    00809 };
    00810
    00817
    00818 class EventKey : public EventAny
    00819 {
    00820 public:
    00823
    00824         GdkEventKey* gdk_event_key() const { return (GdkEventKey*)boxed_; }
    00826
    00827         unsigned int time() const;
    00829
    00830         ModifierTypeField state() const;
    00833
    00834         Keyval keyval() const;
    00837
    00838         unsigned short hardware_keycode() const;
    00840
    00841         unsigned char group() const;
    00843
    00845 };
    00846
    00853
    00854 class EventCrossing : public EventAny
    00855 {
    00856 public:
    00859
    00860         GdkEventCrossing* gdk_event_crossing() const { return (GdkEventCrossing*)boxed_; }
    00862
    00863         Window* subwindow() const;
    00865
    00866         unsigned int time() const;
    00868
    00869         double x() const;
    00871
    00872         double y() const;
    00874
    00875         double x_root() const;
    00877
    00878         double y_root() const;
    00880
    00881         CrossingMode mode() const;
    00883
    00884         NotifyType detail() const;
    00887
    00888         bool focus() const;
    00890
    00891         ModifierTypeField state() const;
    00894
    00896 };
    00897
    00904
    00905 class EventFocus : public EventAny
    00906 {
    00907 public:
    00910
    00911         GdkEventFocus* gdk_event_focus() const { return (GdkEventFocus*)boxed_; }
    00913
    00914         bool in() const;
    00916
    00917         bool out() const;
    00919
    00921 };
    00922
    00929
    00930 class EventConfigure : public EventAny
    00931 {
    00932 public:
    00935
    00936         GdkEventConfigure* gdk_event_configure() const { return (GdkEventConfigure*)boxed_; }
    00938
    00939         int x() const;
    00941
    00942         int y() const;
    00944
    00945         int width() const;
    00947
    00948         int height() const;
    00950
    00952 };
    00953
    00960
    00961 class EventProperty : public EventAny
    00962 {
    00963 public:
    00966
    00967         GdkEventProperty* gdk_event_property() const { return (GdkEventProperty*)boxed_; }
    00969
    00970         Atom atom() const;
    00972
    00973         unsigned int time() const;
    00975
    00976         PropertyState state() const;
    00978
    00980 };
    00981
    00989
    00990 class EventSelection : public EventAny
    00991 {
    00992 public:
    00995
    00996         GdkEventSelection* gdk_event_selection() const { return (GdkEventSelection*)boxed_; }
    00998
    00999         Atom selection() const;
    01001
    01002         Atom target() const;
    01004
    01005         Atom property() const;
    01007
    01008         unsigned int time() const;
    01010
    01011         GdkNativeWindow requestor() const;
    01013
    01015 };
    01016
    01027
    01028 class EventProximity : public EventAny
    01029 {
    01030 public:
    01033
    01034         GdkEventProximity* gdk_event_proximity() const { return (GdkEventProximity*)boxed_; }
    01036
    01037         unsigned int time() const;
    01039
    01040         Device* device() const;
    01042
    01044 };
    01045
    01052
    01053 class EventClient : public EventAny
    01054 {
    01055 public:
    01058
    01059         GdkEventClient* gdk_event_client() const { return (GdkEventClient*)boxed_; }
    01061
    01062         Atom message_type() const;
    01064
    01065         unsigned short data_format() const;
    01067
    01068         const char* char_data() const;
    01070
    01071         const short* short_data() const;
    01073
    01074         const long* long_data() const;
    01076
    01078 };
    01079
    01086
    01087 class EventSetting : public EventAny
    01088 {
    01089 public:
    01092
    01093         GdkEventSetting* gdk_event_setting() const { return (GdkEventSetting*)boxed_; }
    01095
    01096         SettingAction action() const;
    01098
    01099         String name() const;
    01101
    01103 };
    01104
    01111
    01112 class EventWindowState : public EventAny
    01113 {
    01114 public:
    01117
    01118         GdkEventWindowState* gdk_event_window_state() const { return (GdkEventWindowState*)boxed_; }
    01120
    01121         WindowStateField changed_mask() const;
    01123
    01124         WindowStateField new_window_state() const;
    01126
    01128 };
    01129
    01136
    01137 class EventDND : public EventAny
    01138 {
    01139 public:
    01142
    01143         GdkEventDND* gdk_event_dnd() const { return (GdkEventDND*)boxed_; }
    01145
    01146         DragContext* context() const;
    01148
    01149         unsigned int time() const;
    01151
    01152         short x_root() const;
    01155
    01156         short y_root() const;
    01159
    01161 };
    01162
    01163 } // namespace Gdk
    01164
    01165 } // namespace Inti
    01166
    01167 #endif // INTI_GDK_EVENTS_H
    01168

Main Page - Footer