11 #import <Cocoa/Cocoa.h> 13 #if defined IGRAPHICS_GL 14 #import <QuartzCore/QuartzCore.h> 17 #include "IGraphicsMac.h" 18 #include "IGraphicsStructs.h" 21 BEGIN_IGRAPHICS_NAMESPACE
26 const float x = floor(bounds.
L * scale);
27 const float y = floor(bounds.
T * scale);
28 const float x2 = ceil(bounds.
R * scale);
29 const float y2 = ceil(bounds.
B * scale);
31 return NSMakeRect(x, y, x2 - x, y2 - y);
37 const float x = pNSRect->origin.x;
38 const float y = pNSRect->origin.y;
39 const float w = pNSRect->size.width;
40 const float h = pNSRect->size.height;
42 return IRECT(x * scale, y * scale, (x + w) * scale, (y + h) * scale);
45 inline NSColor* ToNSColor(
const IColor& c)
47 return [NSColor colorWithDeviceRed:(double) c.R / 255.0 green:(
double) c.G / 255.0 blue:(double) c.B / 255.0 alpha:(
double) c.A / 255.0];
50 inline IColor FromNSColor(
const NSColor* c)
52 return IColor(c.alphaComponent * 255., c.redComponent* 255., c.greenComponent * 255., c.blueComponent * 255.);
57 return pGraphics->GetMouseOver();
60 END_IGRAPHICS_NAMESPACE
64 @interface IGRAPHICS_FORMATTER : NSFormatter
66 NSCharacterSet* filterCharacterSet;
71 - (void) setAcceptableCharacterSet: (NSCharacterSet*) pCharacterSet;
72 - (void) setMaximumLength:(
int) inLength;
73 - (void) setMaximumValue:(
int) inValue;
77 @interface IGRAPHICS_TEXTFIELDCELL : NSTextFieldCell
79 BOOL mIsEditingOrSelecting;
84 using namespace iplug;
85 using namespace igraphics;
87 @interface IGRAPHICS_MENU : NSMenu
91 - (id) initWithIPopupMenuAndReceiver: (
IPopupMenu*) pMenu : (NSView*) pView;
96 @interface IGRAPHICS_MENU_RCVR : NSView
98 NSMenuItem* nsMenuItem;
100 - (void) onMenuSelection:(
id)sender;
101 - (NSMenuItem*) menuItem;
104 @interface IGRAPHICS_TEXTFIELD : NSTextField
107 - (bool) becomeFirstResponder;
111 #define VIEW_BASE NSOpenGLView 113 #define VIEW_BASE NSView 116 @interface IGRAPHICS_VIEW : VIEW_BASE <NSTextFieldDelegate>
118 CVDisplayLinkRef mDisplayLink;
119 dispatch_source_t mDisplaySource;
122 NSTrackingArea* mTrackingArea;
123 IGRAPHICS_TEXTFIELD* mTextFieldView;
124 NSCursor* mMoveCursor;
125 float mPrevX, mPrevY;
126 bool mMouseOutDuringDrag;
128 IColorPickerHandlerFunc mColorPickerFunc;
134 - (BOOL) acceptsFirstResponder;
135 - (BOOL) acceptsFirstMouse: (NSEvent*) pEvent;
136 - (void) viewDidMoveToWindow;
137 - (void) viewDidChangeBackingProperties: (NSNotification*) pNotification;
138 - (void) drawRect: (NSRect) bounds;
141 - (void) onTimer: (NSTimer*) pTimer;
143 - (void) getMouseXY: (NSEvent*) pEvent : (
float&) x : (
float&) y;
144 - (
IMouseInfo) getMouseLeft: (NSEvent*) pEvent;
145 - (
IMouseInfo) getMouseRight: (NSEvent*) pEvent;
146 - (void) updateTrackingAreas;
147 - (void) mouseEntered:(NSEvent*) pEvent;
148 - (void) mouseExited:(NSEvent*) pEvent;
149 - (void) mouseDown: (NSEvent*) pEvent;
150 - (void) mouseUp: (NSEvent*) pEvent;
151 - (void) mouseDragged: (NSEvent*) pEvent;
152 - (void) rightMouseDown: (NSEvent*) pEvent;
153 - (void) rightMouseUp: (NSEvent*) pEvent;
154 - (void) rightMouseDragged: (NSEvent*) pEvent;
155 - (void) mouseMoved: (NSEvent*) pEvent;
156 - (void) scrollWheel: (NSEvent*) pEvent;
157 - (void) keyDown: (NSEvent*) pEvent;
158 - (void) keyUp: (NSEvent*) pEvent;
160 - (void) removeFromSuperview;
161 - (void) controlTextDidEndEditing: (NSNotification*) pNotification;
162 - (void) createTextEntry: (
int) paramIdx : (const
IText&) text : (const
char*) str : (
int) length : (NSRect) areaRect;
163 - (void) endUserInput;
167 - (BOOL) promptForColor: (
IColor&) color : (IColorPickerHandlerFunc) func;
168 - (void) onColorPicked: (NSColorPanel*) pColorPanel;
171 - (NSString*) view: (NSView*) pView stringForToolTip: (NSToolTipTag) tag point: (NSPoint) point userData: (
void*) pData;
172 - (void) registerToolTip: (
IRECT&) bounds;
174 - (NSDragOperation) draggingEntered: (
id <NSDraggingInfo>) sender;
175 - (BOOL) performDragOperation: (
id<NSDraggingInfo>) sender;
177 - (void) setMouseCursor: (ECursor) cursorType;
180 #if defined IGRAPHICS_IMGUI 181 #import <MetalKit/MetalKit.h> 183 @interface IGRAPHICS_IMGUIVIEW : MTKView
185 IGRAPHICS_VIEW* mView;
187 @property (nonatomic, strong) id <MTLCommandQueue> commandQueue;
188 - (id) initWithIGraphicsView: (IGRAPHICS_VIEW*) pView;
Used to manage a list of rectangular areas and optimize them for drawing to the screen.
Used to manage a rectangular area, independent of draw class/platform.
Used to manage color data, independent of draw class/platform.
float R
Right side of the rectangle (X + W)
IGraphics platform class for macOS.
IText is used to manage font and text/text entry style for a piece of text on the UI...
float GetDrawScale() const
Gets the graphics context scaling factor.
Used to group mouse coordinates with mouse modifier information.
The lowest level base class of an IGraphics context.
float L
Left side of the rectangle (X)
float T
Top of the rectangle (Y)
float B
Bottom of the rectangle (Y + H)