4 // Created by Marc Feeley on 11-03-06.
5 // Copyright 2011-2012 Université de Montréal. All rights reserved.
8 #import <UIKit/UIKit.h>
9 #import <CoreLocation/CoreLocation.h>
10 #import <MessageUI/MessageUI.h>
13 // ViewController methods callable from Scheme.
15 void set_navigation(int n
);
16 void show_cancelButton();
17 void hide_cancelButton();
18 void show_webView(int view
);
19 void show_textView(int view
);
20 void show_imageView(int view
);
21 void set_textView_font(int view
, NSString
*name
, int size
);
22 void set_textView_content(int view
, NSString
*str
);
23 NSString
*get_textView_content(int view
);
24 void add_output_to_textView(int view
, NSString
*str
);
25 void add_input_to_textView(int view
, NSString
*str
);
26 void set_webView_content(int view
, NSString
*str
, NSString
*base_url_path
, BOOL enable_scaling
, NSString
*mime_type
);
27 void set_webView_content_from_file(int view
, NSString
*path
, NSString
*base_url_path
, BOOL enable_scaling
, NSString
*mime_type
);
28 NSString
*eval_js_in_webView(int view
, NSString
*script
);
29 void open_URL(NSString
*url
);
30 BOOL
send_SMS(NSString
*recipient
, NSString
*messsage
);
32 void set_idle_timer(BOOL enable
);
33 void set_toolbar_alpha(double alpha
);
34 void segm_ctrl_set_title(int segment
, NSString
*title
);
35 void segm_ctrl_insert(int segment
, NSString
*title
);
36 void segm_ctrl_remove(int segment
);
37 void segm_ctrl_remove_all();
38 void set_pref(NSString
*key
, NSString
*value
);
39 NSString
*get_pref(NSString
*key
);
40 void set_pasteboard(NSString
*value
);
41 NSString
*get_pasteboard();
42 NSString
*get_documents_dir();
43 void popup_alert(NSString
*title
, NSString
*msg
, NSString
*cancel_button
, NSString
*accept_button
);
44 void setup_location_updates(double desired_accuracy
, double distance_filter
);
47 #define NB_TEXTVIEWS 2
48 #define NB_IMAGEVIEWS 2
50 @interface ViewController
: UIViewController
<UITextViewDelegate
,UIWebViewDelegate
,UIAlertViewDelegate
,CLLocationManagerDelegate
,MFMessageComposeViewControllerDelegate
,UINavigationControllerDelegate
,UIImagePickerControllerDelegate
> {
52 UISegmentedControl
*segmCtrl
;
53 UIWebView
*webViews
[NB_WEBVIEWS
];
58 UITextView
*textViews
[NB_TEXTVIEWS
];
59 UITextView
*textView0
;
60 UITextView
*textView1
;
61 UIImageView
*imageViews
[NB_IMAGEVIEWS
];
62 UIImageView
*imageView0
;
63 UIImageView
*imageView1
;
64 UIButton
*cancelButton
;
65 UIView
*accessoryView
;
69 NSMutableArray
*queuedActions
;
70 CLLocationManager
*locationManager
;
73 @
property (nonatomic
, assign
) IBOutlet UISegmentedControl
*segmCtrl
;
74 @
property (nonatomic
, assign
) IBOutlet UIWebView
*webView0
;
75 @
property (nonatomic
, assign
) IBOutlet UIWebView
*webView1
;
76 @
property (nonatomic
, assign
) IBOutlet UIWebView
*webView2
;
77 @
property (nonatomic
, assign
) IBOutlet UIWebView
*webView3
;
78 @
property (nonatomic
, retain
) IBOutlet UITextView
*textView0
;
79 @
property (nonatomic
, retain
) IBOutlet UITextView
*textView1
;
80 @
property (nonatomic
, retain
) IBOutlet UIImageView
*imageView0
;
81 @
property (nonatomic
, retain
) IBOutlet UIImageView
*imageView1
;
82 @
property (nonatomic
, assign
) IBOutlet UIButton
*cancelButton
;
83 @
property (nonatomic
, assign
) IBOutlet UIView
*accessoryView
;
84 @
property (nonatomic
, assign
) IBOutlet UIToolbar
*toolbar
;
85 @
property (assign
) int keyboardSounds
;
86 @
property (assign
) NSTimer
*timer
;
87 @
property (assign
) NSMutableArray
*queuedActions
;
88 @
property (assign
) CLLocationManager
*locationManager
;
90 - (void)queue_action
:(void(^)())action
;
91 - (void)send_event
:(NSString
*)name
;
92 - (void)send_key
:(NSString
*)name
;
93 - (void)heartbeat_tick
;
94 - (void)schedule_next_heartbeat_tick
:(double)interval
;
96 - (void)app_become_active
;
98 - (IBAction
)navigation_changed
:(id
)sender
;
100 - (IBAction
)touch_up_cancel
:(id
)sender
;
102 - (IBAction
)touch_down
:(id
)sender
;
103 - (IBAction
)touch_up_F1
:(id
)sender
;
104 - (IBAction
)touch_up_F2
:(id
)sender
;
105 - (IBAction
)touch_up_F3
:(id
)sender
;
106 - (IBAction
)touch_up_F4
:(id
)sender
;
107 - (IBAction
)touch_up_F5
:(id
)sender
;
108 - (IBAction
)touch_up_F6
:(id
)sender
;
109 - (IBAction
)touch_up_F7
:(id
)sender
;
110 - (IBAction
)touch_up_F8
:(id
)sender
;
111 - (IBAction
)touch_up_F9
:(id
)sender
;
112 - (IBAction
)touch_up_F10
:(id
)sender
;
113 - (IBAction
)touch_up_F11
:(id
)sender
;
114 - (IBAction
)touch_up_F12
:(id
)sender
;
115 - (IBAction
)touch_up_F13
:(id
)sender
;
116 - (IBAction
)touch_up_SHARP
:(id
)sender
;
117 - (IBAction
)touch_up_DQUOTE
:(id
)sender
;
118 - (IBAction
)touch_up_QUOTE
:(id
)sender
;
119 - (IBAction
)touch_up_COMMA
:(id
)sender
;
120 - (IBAction
)touch_up_PLUS
:(id
)sender
;
121 - (IBAction
)touch_up_MINUS
:(id
)sender
;
122 - (IBAction
)touch_up_STAR
:(id
)sender
;
123 - (IBAction
)touch_up_SLASH
:(id
)sender
;
124 - (IBAction
)touch_up_LPAREN
:(id
)sender
;
125 - (IBAction
)touch_up_RPAREN
:(id
)sender
;