src/video/uikit/SDL_uikitview.h
author Ryan C. Gordon <icculus@icculus.org>
Wed, 03 Apr 2013 11:34:21 -0400
changeset 7050 aa1f44908402
parent 6885 700f1b25f77f
child 7962 e4d2f3375868
permissions -rw-r--r--
Fixed compiler warnings. "leftFingerDown" doesn't need to be an SDL_FingerID.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
     2
  Simple DirectMedia Layer
6885
700f1b25f77f Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6654
diff changeset
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
     7
  arising from the use of this software.
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    11
  freely, subject to the following restrictions:
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5527
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
#import <UIKit/UIKit.h>
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents: 5535
diff changeset
    23
#import "SDL_uikitviewcontroller.h"
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
6597
d359909f8121 Remember what finger was used for left button down and only send mouse events for that finger.
Sam Lantinga <slouken@libsdl.org>
parents: 6436
diff changeset
    25
#include "SDL_touch.h"
d359909f8121 Remember what finger was used for left button down and only send mouse events for that finger.
Sam Lantinga <slouken@libsdl.org>
parents: 6436
diff changeset
    26
4677
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents: 4676
diff changeset
    27
#define IPHONE_TOUCH_EFFICIENT_DANGEROUS
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents: 4676
diff changeset
    28
4662
3c4e0130c9b1 Added alternative finger tracking method. Still prefer IPHONE_TOUCH_EFFICIENT_DANGEROUS.
Jim Grandpre <jim.tla@gmail.com>
parents: 4661
diff changeset
    29
#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
#define MAX_SIMULTANEOUS_TOUCHES 5
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
#endif
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
3487
24d13328c44a Eric Wing to Sam, hfutrell
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    33
#if SDL_IPHONE_KEYBOARD
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
@interface SDL_uikitview : UIView<UITextFieldDelegate> {
3487
24d13328c44a Eric Wing to Sam, hfutrell
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    35
#else
24d13328c44a Eric Wing to Sam, hfutrell
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    36
@interface SDL_uikitview : UIView {
24d13328c44a Eric Wing to Sam, hfutrell
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    37
#endif
4488
6dc6a2bdd55e Re-implemented single mouse touches on the iPhone/iPad
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
    38
6597
d359909f8121 Remember what finger was used for left button down and only send mouse events for that finger.
Sam Lantinga <slouken@libsdl.org>
parents: 6436
diff changeset
    39
    SDL_TouchID touchId;
7050
aa1f44908402 Fixed compiler warnings. "leftFingerDown" doesn't need to be an SDL_FingerID.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
    40
    UITouch *leftFingerDown;
4662
3c4e0130c9b1 Added alternative finger tracking method. Still prefer IPHONE_TOUCH_EFFICIENT_DANGEROUS.
Jim Grandpre <jim.tla@gmail.com>
parents: 4661
diff changeset
    41
#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
5133
b915b3181cc2 Fixed spacing, adding vim spacing hints
Sam Lantinga <slouken@libsdl.org>
parents: 4677
diff changeset
    42
    UITouch *finger[MAX_SIMULTANEOUS_TOUCHES];
4662
3c4e0130c9b1 Added alternative finger tracking method. Still prefer IPHONE_TOUCH_EFFICIENT_DANGEROUS.
Jim Grandpre <jim.tla@gmail.com>
parents: 4661
diff changeset
    43
#endif
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
#if SDL_IPHONE_KEYBOARD
5133
b915b3181cc2 Fixed spacing, adding vim spacing hints
Sam Lantinga <slouken@libsdl.org>
parents: 4677
diff changeset
    46
    UITextField *textField;
b915b3181cc2 Fixed spacing, adding vim spacing hints
Sam Lantinga <slouken@libsdl.org>
parents: 4677
diff changeset
    47
    BOOL keyboardVisible;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    48
#endif
5520
09b500e0656d Added orientation rotation for iOS.
Ryan C. Gordon <icculus@icculus.org>
parents: 5262
diff changeset
    49
09b500e0656d Added orientation rotation for iOS.
Ryan C. Gordon <icculus@icculus.org>
parents: 5262
diff changeset
    50
@public
09b500e0656d Added orientation rotation for iOS.
Ryan C. Gordon <icculus@icculus.org>
parents: 5262
diff changeset
    51
    SDL_uikitviewcontroller *viewcontroller;
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
}
6436
29a35c72905a Fixed retina display input scaling
Sam Lantinga <slouken@libsdl.org>
parents: 6392
diff changeset
    53
- (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize;
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
#if SDL_IPHONE_KEYBOARD
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
- (void)showKeyboard;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
- (void)hideKeyboard;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
- (void)initializeKeyboard;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
@property (readonly) BOOL keyboardVisible;
6392
fa7eb111f994 Fixed bug 1564 - SDL has no function to open a screen keyboard on Android.
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    63
6654
2ecfb25be1e2 Synchronized the on-screen keyboard state with whether we are accepting text input.
Sam Lantinga <slouken@libsdl.org>
parents: 6597
diff changeset
    64
SDL_bool UIKit_HasScreenKeyboardSupport(_THIS);
2ecfb25be1e2 Synchronized the on-screen keyboard state with whether we are accepting text input.
Sam Lantinga <slouken@libsdl.org>
parents: 6597
diff changeset
    65
void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window);
2ecfb25be1e2 Synchronized the on-screen keyboard state with whether we are accepting text input.
Sam Lantinga <slouken@libsdl.org>
parents: 6597
diff changeset
    66
void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window);
6392
fa7eb111f994 Fixed bug 1564 - SDL has no function to open a screen keyboard on Android.
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    67
SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window);
fa7eb111f994 Fixed bug 1564 - SDL has no function to open a screen keyboard on Android.
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    68
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    69
#endif
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
@end
5133
b915b3181cc2 Fixed spacing, adding vim spacing hints
Sam Lantinga <slouken@libsdl.org>
parents: 4677
diff changeset
    72
b915b3181cc2 Fixed spacing, adding vim spacing hints
Sam Lantinga <slouken@libsdl.org>
parents: 4677
diff changeset
    73
/* vi: set ts=4 sw=4 expandtab: */