~ubuntu-branches/ubuntu/oneiric/nux/oneiric

« back to all changes in this revision

Viewing changes to NuxGraphics/Events.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-25 13:42:45 UTC
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: james.westby@ubuntu.com-20110825134245-kfz5nhs15353wcbl
Tags: upstream-1.4.0
ImportĀ upstreamĀ versionĀ 1.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
#define NUX_F23    NUX_VK_F23
115
115
#define NUX_F24    NUX_VK_F24
116
116
 
117
 
#define NUX_LEFT_MOUSE  1
118
 
#define NUX_MIDDLE_MOUSE        2
119
 
#define NUX_RIGHT_MOUSE 3
 
117
  enum MouseButton
 
118
  {
 
119
    NUX_INVALID_MOUSE_BUTTON = 0,
 
120
    NUX_MOUSE_BUTTON1 = 1,
 
121
    NUX_MOUSE_BUTTON2 = 2,
 
122
    NUX_MOUSE_BUTTON3 = 3,
 
123
    NUX_MOUSE_BUTTON4 = 4,
 
124
    NUX_MOUSE_BUTTON5 = 5,
 
125
    NUX_MOUSE_BUTTON6 = 6,
 
126
    NUX_LEFT_MOUSE = NUX_MOUSE_BUTTON1,   // Deprecated
 
127
    NUX_MIDDLE_MOUSE = NUX_MOUSE_BUTTON2, // Deprecated
 
128
    NUX_RIGHT_MOUSE = NUX_MOUSE_BUTTON3,  // Deprecated
 
129
  };
120
130
 
121
 
// Key States. Set in e_key_modifiers.
122
 
#define NUX_STATE_SHIFT       0x00010000
123
 
#define NUX_STATE_CAPS_LOCK       0x00020000
124
 
#define NUX_STATE_CTRL              0x00040000
125
 
#define NUX_STATE_ALT                 0x00080000
126
 
#define NUX_STATE_NUMLOCK           0x00100000          // most X servers do this?
127
 
#define NUX_STATE_META              0x00400000          // correct for XFree86
128
 
#define NUX_STATE_SCROLLLOCK    0x00800000          // correct for XFree86
 
131
  enum KeyModifier
 
132
  {
 
133
    NUX_STATE_SHIFT           = 0x00010000,
 
134
    NUX_STATE_CAPS_LOCK   = 0x00020000,
 
135
    NUX_STATE_CTRL                  = 0x00040000,
 
136
    NUX_STATE_ALT                     = 0x00080000,
 
137
    NUX_STATE_NUMLOCK       = 0x00100000,
 
138
    NUX_STATE_META                  = 0x00400000,
 
139
    NUX_STATE_SCROLLLOCK        = 0x00800000,
 
140
  };
129
141
 
130
142
// These flags describe the mouse button responsible for the mouse event.
131
143
// They are valid only for the current frame.
203
215
    NUX_DND_LEAVE_WINDOW,   //!< Emitted when the DND action goes outside (XdndEnter) a window.
204
216
  };
205
217
 
206
 
  unsigned long GetEventButton(unsigned long button_state);
207
 
  bool GetButtonState(unsigned long button_state, int button);
 
218
  //! Returns index of the mouse button that triggered an event.
 
219
  /*!
 
220
      Given the mouse button states of and event, returns the index of the button that
 
221
      triggered an event. The index of the left mouse button is 1 and the index for the right 
 
222
      mouse button is 2. If 0 is returned, then a mouse button didn't triggered the event.
 
223
 
 
224
      @param button_state The mouse button states of an event.
 
225
      @return The button that triggered the event.
 
226
  */
 
227
  MouseButton GetEventButton(unsigned long button_state);
 
228
 
 
229
  //! Returns the state of a mouse button: pressed or released.
 
230
  /*!
 
231
      Given the mouse button states of and event, returns the state of a mouse button.
 
232
      True is the button is pressed. False otherwise.
 
233
 
 
234
      @param button_state The mouse button states of an event.
 
235
      @param button Button to query (1 for left mouse button).
 
236
      @return True is the button is pressed. False otherwise.
 
237
  */
 
238
  bool GetButtonState(unsigned long button_state, MouseButton button);
208
239
    
 
240
  //! Returns the state of a special key: CTRL, Shift, Alt, NumLock...
 
241
  /*!
 
242
      Given the key modifiers states of and event, returns the state of a key modifier.
 
243
      True is the key is pressed. False otherwise.
 
244
 
 
245
      @param key_modifiers_state The key modifiers states of an event.
 
246
      @param key_modifier Key modifier be query.
 
247
      @return True is the key is pressed. False otherwise.
 
248
  */
 
249
  bool GetKeyModifierState(unsigned long key_modifiers_states, KeyModifier key_modifier);
 
250
 
209
251
  #define NUX_EVENT_TEXT_BUFFER_SIZE 16
210
252
 
211
253
  //! Nux event class.
227
269
    unsigned long GetKeyState() const;
228
270
    unsigned long GetMouseState() const;
229
271
 
230
 
    /*!
231
 
        Get the button responsible for the event.
232
 
        @return The index of the button responsible for the event: 1 left mouse button, 2 middle mouse button, 3 right mouse button.
233
 
    */
234
 
    unsigned long GetEventButton() const;
235
 
 
236
 
    /*!
237
 
        Check if a mouse button is down.
238
 
        @param button The button whose state is to be checked.
239
 
        @return True if the button is down.
240
 
    */
241
 
    bool GetButtonState(int button) const;
242
 
 
243
 
 
 
272
    //! Returns index of the mouse button that triggered this event.
 
273
    /*!
 
274
        Returns the index of the button that triggered this event.
 
275
        The index of the left mouse button is 1 and the index for the right 
 
276
        mouse button is 2. If 0 is returned, then a mouse button didn't triggered the event.
 
277
 
 
278
        @return The button that triggered the event.
 
279
    */
 
280
    MouseButton GetEventButton() const;
 
281
 
 
282
    //! Returns the state of a mouse button: pressed or released.
 
283
    /*!
 
284
        Returns the state of a mouse button.
 
285
        True is the button is pressed. False otherwise.
 
286
 
 
287
        @param button_index Button index to query (1 for left mouse button).
 
288
        @return True is the button is pressed. False otherwise.
 
289
    */
 
290
    bool GetButtonState(MouseButton button) const;
 
291
 
 
292
    //! Returns the state of a special key: CTRL, Shift, Alt, NumLock...
 
293
    /*!
 
294
        Returns the state of a key modifier.
 
295
        True is the key is pressed. False otherwise.
 
296
 
 
297
        @param key_modifier Key modifier be query.
 
298
        @return True is the key is pressed. False otherwise.
 
299
    */
 
300
    bool GetKeyModifierState(KeyModifier key_modifier) const;
244
301
 
245
302
    //! Return virtual key code of the key that has triggered the last event.
246
303
    /*!
293
350
  };
294
351
 
295
352
  typedef Event IEvent;
296
 
}
 
353
};
297
354
 
298
355
#endif // EVENTS_H