Minsky
minsky::NSContext Struct Reference

#include <getContext.h>

Collaboration diagram for minsky::NSContext:
Collaboration graph

Public Member Functions

 NSContext (void *nativeHandle, int xoffs, int yoffs, int width, int height, WindowInformation &)
 
 ~NSContext ()
 
void requestRedraw ()
 
 NSContext (const NSContext &)=delete
 
 NSContext (NSContext &&)
 
void operator= (const NSContext &)=delete
 

Public Attributes

std::unique_ptr< ViewImplimpl
 

Detailed Description

Definition at line 31 of file getContext.h.

Constructor & Destructor Documentation

◆ NSContext() [1/3]

minsky::NSContext::NSContext ( void *  nativeHandle,
int  xoffs,
int  yoffs,
int  width,
int  height,
WindowInformation winfo 
)

Definition at line 71 of file getContext.cc.

References minsky::WindowInformation::hasScrollBars, and impl.

74  {
75  NSView* view=reinterpret_cast<NSView*>(nativeHandle);
76  // check that we are passed a valid NSView pointer (must be an in-process call).
77  @try {
78  SetSignal sigHandler;
79  [view class];
80  }
81  @catch (NSException*)
82  {
83  throw runtime_error("Different process space not supported on MacOSX");
84  }
85 
86  impl=make_unique<ViewImpl>();
87 
88  // do not overwrite scrollbar
89  if (winfo.hasScrollBars)
90  {
91  width-=20;
92  }
93  [impl->cairoView setFrameSize: NSMakeSize(width,height)];
94  [impl->cairoView setWinfo: &winfo];
95  [view addSubview: impl->cairoView];
96  }
std::unique_ptr< ViewImpl > impl
Definition: getContext.h:33

◆ ~NSContext()

minsky::NSContext::~NSContext ( )
default

◆ NSContext() [2/3]

minsky::NSContext::NSContext ( const NSContext )
delete

◆ NSContext() [3/3]

minsky::NSContext::NSContext ( NSContext &&  )
default

Member Function Documentation

◆ operator=()

void minsky::NSContext::operator= ( const NSContext )
delete

◆ requestRedraw()

void minsky::NSContext::requestRedraw ( )

Definition at line 100 of file getContext.cc.

References impl.

101  {
102  [impl->cairoView setNeedsDisplay: true];
103  }
std::unique_ptr< ViewImpl > impl
Definition: getContext.h:33

Member Data Documentation

◆ impl

std::unique_ptr<ViewImpl> minsky::NSContext::impl

Definition at line 33 of file getContext.h.

Referenced by NSContext(), and requestRedraw().


The documentation for this struct was generated from the following files: