--- /dev/null
+/* This file is part of SDL_him - SDL Hildon Input Method addon
+ * Copyright (C) 2010 Javier S. Pedro
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA or see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __SDL_HIM_H
+#define __SDL_HIM_H
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Equivalent (and binary compatible) to HildonIMTrigger */
+typedef enum HIM_Trigger
+{
+ HIM_TRIGGER_NONE = -1,
+ HIM_TRIGGER_STYLUS,
+ HIM_TRIGGER_FINGER,
+ HIM_TRIGGER_KEY
+} HIM_Trigger;
+
+/* Equivalent (and binary compatible) to HildonGtkInputMode */
+typedef enum HIM_Mode
+{
+ HIM_MODE_NONE = 0,
+ HIM_MODE_ALPHA = 1 << 0,
+ HIM_MODE_NUMERIC = 1 << 1,
+ HIM_MODE_SPECIAL = 1 << 2,
+ HIM_MODE_HEXA = 1 << 3,
+ HIM_MODE_TELE = 1 << 4,
+
+ HIM_MODE_FULL = (HIM_MODE_ALPHA | HIM_MODE_NUMERIC | HIM_MODE_SPECIAL),
+
+ /** This is a special SDL_him setting which causes it to keep sending
+ SDL_KEYDOWN events on most "normal" keys.
+ */
+ HIM_MODE_NO_FILTER = 1 << 10,
+
+ HIM_MODE_MULTILINE = 1 << 28,
+ HIM_MODE_INVISIBLE = 1 << 29,
+ HIM_MODE_AUTOCAP = 1 << 30,
+ HIM_MODE_DICTIONARY = 1 << 31
+} HIM_Mode;
+
+#define HIM_TEXTEVENT_SIZE 32
+typedef struct HIM_TextEvent {
+ Uint8 type;
+ Uint8 code;
+} HIM_TextEvent;
+
+#define HIM_TEXTINPUTEVENT_TEXT_SIZE (32-2)
+#define HIM_TEXTINPUTEVENT 1
+typedef struct HIM_TextInputEvent {
+ Uint8 type;
+ Uint8 code;
+ char text[HIM_TEXTINPUTEVENT_TEXT_SIZE];
+} HIM_TextInputEvent;
+
+#define HIM_TEXTEDITINGEVENT_TEXT_SIZE (32-2)
+#define HIM_TEXTEDITINGEVENT 2
+typedef struct HIM_TextEditingEvent {
+ Uint8 type;
+ Uint8 code;
+ char text[HIM_TEXTEDITINGEVENT_TEXT_SIZE];
+} HIM_TextEditingEvent;
+
+#define HIM_SPECIALKEYEVENT 3
+typedef struct HIM_SpecialKeyEvent {
+ Uint8 type;
+ Uint8 code;
+ SDLKey sym;
+} HIM_SpecialKeyEvent;
+
+#define HIM_CURSORMOVEEVENT 4
+typedef struct HIM_CursorMoveEvent {
+ Uint8 type;
+ Uint8 code;
+ Uint8 relative;
+ Sint32 offset;
+} HIM_CursorMoveEvent;
+
+#define HIM_REQUESTSURROUNDINGEVENT 5
+typedef struct HIM_RequestSurroundingEvent {
+ Uint8 type;
+ Uint8 code;
+ Uint8 full;
+} HIM_RequestSurroundingEvent;
+
+#define HIM_CLIPBOARDEVENT 6
+typedef enum HIM_ClipboardAction {
+ HIM_CLIPBOARD_NONE = 0,
+ HIM_CLIPBOARD_CUT,
+ HIM_CLIPBOARD_COPY,
+ HIM_CLIPBOARD_PASTE,
+ HIM_CLIPBOARD_REQUEST_SELECTION
+} HIM_ClipboardAction;
+typedef struct HIM_ClipboardEvent {
+ Uint8 type;
+ Uint8 code;
+ HIM_ClipboardAction action;
+} HIM_ClipboardEvent;
+
+/** Invoke after SDL_Init.
+ @param flags 0
+ @param event event identifier to bind the library to
+ (SDL_USEREVENT through SDL_NUMEVENTS-1)
+ @return 0 if SDL_him was initialized correctly.
+ */
+extern DECLSPEC int SDLCALL HIM_Init(Uint32 flags, Uint8 event);
+
+/** Invoke after SDL_Quit. */
+extern DECLSPEC void SDLCALL HIM_Quit();
+
+extern DECLSPEC void SDLCALL HIM_Enable(HIM_Mode mode);
+extern DECLSPEC void SDLCALL HIM_Disable();
+
+extern DECLSPEC void SDLCALL HIM_ShowKeyboard(HIM_Trigger reason);
+extern DECLSPEC void SDLCALL HIM_HideKeyboard();
+
+/**
+ Call before handling any SDL_Event (or use SDL_SetEventFilter).
+ @param event the SDL_Event you were about to handle.
+ @return 1 if the event was filtered and should not be handled by your app.
+ */
+extern DECLSPEC int SDLCALL HIM_FilterEvent(const SDL_Event *event);
+
+/**
+ Call in the RequestSurrounding event handler.
+ @param text
+ @param cursor where the cursor is, relative to text.
+ */
+extern DECLSPEC void SDLCALL HIM_SendSurrounding
+ (const char * text, unsigned long cursor);
+
+/**
+ Call in the ClipboardRequestSelection event handler.
+ @param text the selected text
+ */
+extern DECLSPEC void SDLCALL HIM_SendSelection
+ (const char * text);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+