Potential add for softKeyboardRect on iOS
This commit is contained in:
@@ -386,6 +386,7 @@ public:
|
||||
void setFocusRect(bool inVal) { focusRect = inVal; }
|
||||
bool getFocusRect() const { return focusRect; }
|
||||
UserPoint getMousePos() const { return mLastMousePos; }
|
||||
virtual int getKeyboardHeight();
|
||||
virtual double getStageWidth();
|
||||
virtual double getStageHeight();
|
||||
virtual double getDPIScale() { return 1.0; }
|
||||
|
||||
@@ -162,6 +162,7 @@ DEFINE_LIME_PROP(stage,align);
|
||||
DEFINE_LIME_PROP(stage,quality);
|
||||
DEFINE_LIME_PROP(stage,display_state);
|
||||
DEFINE_LIME_PROP(stage,multitouch_active);
|
||||
DEFINE_LIME_PROP_READ(stage,keyboard_height);
|
||||
DEFINE_LIME_PROP_READ(stage,stage_width);
|
||||
DEFINE_LIME_PROP_READ(stage,stage_height);
|
||||
DEFINE_LIME_PROP_READ(stage,dpi_scale);
|
||||
|
||||
@@ -1534,6 +1534,7 @@ DO_STAGE_PROP(align,Align,alloc_int,val_int)
|
||||
DO_STAGE_PROP(quality,Quality,alloc_int,val_int)
|
||||
DO_STAGE_PROP(display_state,DisplayState,alloc_int,val_int)
|
||||
DO_STAGE_PROP(multitouch_active,MultitouchActive,alloc_bool,val_bool)
|
||||
DO_PROP_READ(Stage,stage,keyboard_height,KeyboardHeight,alloc_int);
|
||||
DO_PROP_READ(Stage,stage,stage_width,StageWidth,alloc_float);
|
||||
DO_PROP_READ(Stage,stage,stage_height,StageHeight,alloc_float);
|
||||
DO_PROP_READ(Stage,stage,dpi_scale,DPIScale,alloc_float);
|
||||
|
||||
@@ -588,6 +588,13 @@ bool Stage::BuildCache()
|
||||
return wasDirty;
|
||||
}
|
||||
|
||||
int Stage::getKeyboardHeight()
|
||||
{
|
||||
//#ifdef IPHONE
|
||||
//return GetKeyboardHeight();
|
||||
//#endif
|
||||
}
|
||||
|
||||
double Stage::getStageWidth()
|
||||
{
|
||||
Surface *s = GetPrimarySurface();
|
||||
|
||||
@@ -2273,6 +2273,8 @@ extern "C" void nme_app_set_active(bool inActive);
|
||||
|
||||
namespace nme { int gFixedOrientation = -1; }
|
||||
|
||||
CGRect keyboardRect = CGRectMake(0, 0, 0, 0);
|
||||
|
||||
|
||||
@interface NMEAppDelegate : NSObject <UIApplicationDelegate>
|
||||
{
|
||||
@@ -2295,6 +2297,9 @@ namespace nme { int gFixedOrientation = -1; }
|
||||
@interface UIStageViewController : UIViewController
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
|
||||
- (void)loadView;
|
||||
- (void)viewWillAppear:(BOOL)animated;
|
||||
- (void)viewWillDisappear:(BOOL)animated;
|
||||
- (void)keyboardChangedStatus:(NSNotification*)notification;
|
||||
@end
|
||||
|
||||
|
||||
@@ -2969,6 +2974,11 @@ public:
|
||||
mRenderBuffer = 1-mRenderBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
int getKeyboardHeight()
|
||||
{
|
||||
return keyboardRect.size.height;
|
||||
}
|
||||
|
||||
void GetMouse()
|
||||
{
|
||||
@@ -3129,6 +3139,32 @@ public:
|
||||
self.view = view;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver:self selector:@selector(keyboardChangedStatus:) name:UIKeyboardWillShowNotification object:nil];
|
||||
[nc addObserver:self selector:@selector(keyboardChangedStatus:) name:UIKeyboardWillHideNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc removeObserver:self name:UIKeyboardWillShowNotification object:nil];
|
||||
[nc removeObserver:self name:UIKeyboardWillHideNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)keyboardChangedStatus:(NSNotification*)notification {
|
||||
//get the size!
|
||||
CGRect keyboardRect;
|
||||
[[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardRect];
|
||||
keyboardRect = [self.view convertRect:keyboardRect fromView:nil];
|
||||
|
||||
//move your view to the top, to display the textfield..
|
||||
//[self moveView:notification keyboardHeight:keyboardHeight];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user