iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
IGraphicsIOS_view.h
1/*
2 ==============================================================================
3
4 This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5
6 See LICENSE.txt for more info.
7
8 ==============================================================================
9*/
10
11#import <UIKit/UIKit.h>
12#include "IGraphicsIOS.h"
13
14BEGIN_IPLUG_NAMESPACE
15BEGIN_IGRAPHICS_NAMESPACE
16
17inline CGRect ToCGRect(IGraphics* pGraphics, const IRECT& bounds)
18{
19 float scale = pGraphics->GetDrawScale();
20 float x = floor(bounds.L * scale);
21 float y = floor(bounds.T * scale);
22 float x2 = ceil(bounds.R * scale);
23 float y2 = ceil(bounds.B * scale);
24
25 return CGRectMake(x, y, x2 - x, y2 - y);
26}
27
28inline UIColor* ToUIColor(const IColor& c)
29{
30 return [UIColor colorWithRed:(double) c.R / 255.0 green:(double) c.G / 255.0 blue:(double) c.B / 255.0 alpha:(double) c.A / 255.0];
31}
32
33inline IColor FromUIColor(const UIColor* c)
34{
35 CGFloat r,g,b,a;
36 [c getRed:&r green:&g blue:&b alpha:&a];
37 return IColor(a * 255., r * 255., g * 255., b * 255.);
38}
39
40END_IGRAPHICS_NAMESPACE
41END_IPLUG_NAMESPACE
42
43using namespace iplug;
44using namespace igraphics;
45
46@interface IGRAPHICS_UITABLEVC : UIViewController<UITableViewDataSource, UITableViewDelegate> // UITableViewController
47{
48 IPopupMenu* mMenu;
49 IGraphicsIOS* mGraphics;
50}
51@property (strong, nonatomic) UITableView* tableView;
52@property (strong, nonatomic) NSMutableArray* items;
53- (id) initWithIPopupMenuAndIGraphics: (IPopupMenu*) pMenu : (IGraphicsIOS*) pGraphics;
54
55@end
56
57@interface IGRAPHICS_VIEW : UIView
58<
59UITextFieldDelegate,
60UIPopoverPresentationControllerDelegate,
61UIGestureRecognizerDelegate,
62UITraitEnvironment,
63UIDocumentPickerDelegate,
64UIColorPickerViewControllerDelegate
65>
66{
67@public
68 IGraphicsIOS* mGraphics;
69 IGRAPHICS_UITABLEVC* mMenuTableController;
70 UINavigationController* mMenuNavigationController;
71 UITextField* mTextField;
72 UIAlertController* mAlertController;
73 CAMetalLayer* mMTLLayer;
74 int mTextFieldLength;
75 IColorPickerHandlerFunc mColorPickerHandlerFunc;
76 IFileDialogCompletionHandlerFunc mFileDialogFunc;
77 float mPrevX, mPrevY;
78}
79- (id) initWithIGraphics: (IGraphicsIOS*) pGraphics;
80- (BOOL) isOpaque;
81- (BOOL) acceptsFirstResponder;
82- (BOOL) delaysContentTouches;
83- (void) removeFromSuperview;
84- (IPopupMenu*) createPopupMenu: (IPopupMenu&) menu : (CGRect) bounds;
85- (void) createTextEntry: (int) paramIdx : (const IText&) text : (const char*) str : (int) length : (CGRect) areaRect;
86- (void) endUserInput;
87- (void) showMessageBox: (const char*) str : (const char*) title : (EMsgBoxType) type : (IMsgBoxCompletionHandlerFunc) completionHandler;
88- (void) promptForFile: (NSString*) fileName : (NSString*) path : (EFileAction) action : (NSArray*) contentTypes : (IFileDialogCompletionHandlerFunc) completionHandler;
89- (void) promptForDirectory: (NSString*) path : (IFileDialogCompletionHandlerFunc) completionHandler;
90- (BOOL) promptForColor: (IColor&) color : (const char*) str : (IColorPickerHandlerFunc) func;
91- (void) presentationControllerDidDismiss: (UIPresentationController*) presentationController;
92
93//UIDocumentPickerDelegate,
94- (void) documentPicker:(UIDocumentPickerViewController*) controller didPickDocumentsAtURLs:(NSArray <NSURL *>*)urls;
95- (void) documentPickerWasCancelled:(UIDocumentPickerViewController*) controller;
96
97//UIColorPickerViewControllerDelegate
98- (void) colorPickerViewControllerDidSelectColor:(UIColorPickerViewController*) viewController;
99- (void) colorPickerViewControllerDidFinish:(UIColorPickerViewController*) viewController;
100
101//gestures
102- (void) attachGestureRecognizer: (EGestureType) type;
103- (BOOL) gestureRecognizer:(UIGestureRecognizer*) gestureRecognizer shouldReceiveTouch:(UITouch*)touch;
104- (void) onTapGesture: (UITapGestureRecognizer*) recognizer;
105- (void) onLongPressGesture: (UILongPressGestureRecognizer*) recognizer;
106- (void) onSwipeGesture: (UISwipeGestureRecognizer*) recognizer;
107- (void) onPinchGesture: (UIPinchGestureRecognizer*) recognizer;
108- (void) onRotateGesture: (UIRotationGestureRecognizer*) recognizer;
109
110- (void) getLastTouchLocation: (float&) x : (float&) y;
111
112- (void) traitCollectionDidChange: (UITraitCollection*) previousTraitCollection;
113
114@property (readonly) CAMetalLayer* metalLayer;
115@property (nonatomic, strong) CADisplayLink *displayLink;
116
117@end
The lowest level base class of an IGraphics context.
Definition: IGraphics.h:86
float GetDrawScale() const
Gets the graphics context scaling factor.
Definition: IGraphics.h:1101
IGraphics platform class for IOS.
Definition: IGraphicsIOS.h:25
A class for setting the contents of a pop up menu.
Used to manage color data, independent of draw class/platform.
Used to manage a rectangular area, independent of draw class/platform.
IText is used to manage font and text/text entry style for a piece of text on the UI,...