All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OSXStubUI.h
1 // Copyright (c) 2014 eeGeo. All rights reserved.
2 
3 #pragma once
4 
5 #include "IInputBox.h"
6 #include "IAlertBoxFactory.h"
7 #include "IInputBoxFactory.h"
8 #include "IKeyboardInputFactory.h"
9 #include "IKeyboardInputDismissedHandler.h"
10 #include "NativeUIFactories.h"
11 #include <Cocoa/Cocoa.h>
12 #include "ISingleOptionAlertBoxDismissedHandler.h"
13 #include "ISingleOptionAlertBox.h"
14 
15 namespace Eegeo
16 {
17  namespace OSX
18  {
20  {
21  public:
22  OSXAlertBox(const std::string& titleText,
23  const std::string& messageText,
25  {
26  NSString *title = [NSString stringWithCString:titleText.c_str()
27  encoding:[NSString defaultCStringEncoding]];
28 
29  NSString *message = [NSString stringWithCString:messageText.c_str()
30  encoding:[NSString defaultCStringEncoding]];
31 
32 
33  NSAlert *alert = [[NSAlert alloc] init];
34  [alert addButtonWithTitle:@"OK"];
35  [alert setMessageText:title];
36  [alert setInformativeText:message];
37 
38  [alert runModal];
39 
40  [alert release];
41 
42  handler.HandleAlertBoxDismissed();
43  }
44 
45  void Close()
46  {
47 
48  }
49  };
50 
52  {
53  UI::NativeAlerts::ISingleOptionAlertBox* CreateSingleOptionAlertBox(const std::string& title,
54  const std::string& message,
56  {
57  return Eegeo_NEW(OSXAlertBox)(title, message, handler);
58  }
59  };
60 
62  {
63  UI::NativeInput::IInputBox* CreateInputBox(const std::string& title,
64  const std::string& message,
65  const std::string& button,
66  const std::string& initialContent,
67  bool initialContentIsPlaceholder,
69  {
70  Eegeo_ASSERT(false, "%s not implemented", __FUNCTION__);
71  return NULL;
72  }
73  };
74 
76  {
79  UI::NativeInput::KeyboardType keyboardType = UI::NativeInput::KeyboardTypeDefault,
80  UI::NativeInput::ReturnKeyType returnKeyType = UI::NativeInput::ReturnKeyDone)
81  {
82  Eegeo_ASSERT(false, "%s not implemented", __FUNCTION__);
83  return NULL;
84  }
85 
86  };
87  }
88 }