src/video/uikit/SDL_uikitview.h
author Alex Szpakowski <slime73@gmail.com>
Sun, 23 Nov 2014 23:23:47 -0400
branchiOS-improvements
changeset 9527 bbd9326ecacf
parent 9519 37ade10d4570
child 9529 4bf9830d8153
permissions -rw-r--r--
Cleaned up the iOS text input code, fixed the orientation of the view offset when the onscreen keyboard is shown in iOS 8+, and changed UIKit_SetTextInputRect to update the view offset if the keyboard is currently visible.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 #import <UIKit/UIKit.h>
    23 #import "SDL_uikitviewcontroller.h"
    24 
    25 #include "SDL_touch.h"
    26 
    27 #if SDL_IPHONE_KEYBOARD
    28 @interface SDL_uikitview : UIView <UITextFieldDelegate>
    29 #else
    30 @interface SDL_uikitview : UIView
    31 #endif
    32 
    33 @property (nonatomic, weak) SDL_uikitviewcontroller *viewcontroller;
    34 
    35 - (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize;
    36 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
    37 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
    38 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
    39 
    40 #if SDL_IPHONE_KEYBOARD
    41 - (void)showKeyboard;
    42 - (void)hideKeyboard;
    43 - (void)initKeyboard;
    44 - (void)deinitKeyboard;
    45 
    46 - (void)keyboardWillShow:(NSNotification *)notification;
    47 - (void)keyboardWillHide:(NSNotification *)notification;
    48 
    49 - (void)updateKeyboard;
    50 
    51 @property (nonatomic, assign, getter=isKeyboardVisible) BOOL keyboardVisible;
    52 @property (nonatomic, assign) SDL_Rect textInputRect;
    53 @property (nonatomic, assign) int keyboardHeight;
    54 
    55 SDL_bool UIKit_HasScreenKeyboardSupport(_THIS);
    56 void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window);
    57 void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window);
    58 SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window);
    59 void UIKit_SetTextInputRect(_THIS, SDL_Rect *rect);
    60 
    61 #endif
    62 
    63 @end
    64 
    65 /* vi: set ts=4 sw=4 expandtab: */