52 void*
CocoaCreateImage(
void* window,
int x,
int y,
int width,
int height,
void* ptr);
53 void*
CocoaCreateButton(
void* window,
int x,
int y,
int width,
int height,
const char *text,
void* ptr);
54 void*
CocoaCreateLabel(
void* window,
int x,
int y,
int width,
int height,
const char *text,
void* ptr);
55 void*
CocoaCreateCheckBox(
void* window,
int x,
int y,
int width,
int height,
const char *text,
bool checked,
void* ptr);
56 void*
CocoaCreateTextEdit(
void* window,
int x,
int y,
int width,
int height,
const char *text,
void* ptr);
57 void*
CocoaCreateSlider(
void* window,
int x,
int y,
int width,
int height,
int min_value,
int max_value,
int step,
int value,
void* ptr);
58 void*
CocoaCreateComboBox(
void* window,
int x,
int y,
int width,
int height,
int num_entries,
const char **entries,
int current_entry,
void* ptr);
107 if (m_event_callback)
109 int s = m_widgets.size();
111 for (
int i = 0; i <
s; i++)
123 m_event_callback->PointClicked(w, params[0], params[1]);
127 m_event_callback->RectSelected(w, params[0], params[1], params[2], params[3]);
131 m_event_callback->MouseDown(w, params[0], params[1], params[2]);
135 m_event_callback->MouseUp(w, params[0], params[1], params[2]);
139 m_event_callback->MouseMove(w, params[0], params[1]);
143 m_event_callback->KeyDown(w, params[0]);
147 m_event_callback->KeyUp(w, params[0]);
151 case eButton: m_event_callback->ButtonPushed(w);
break;
155 m_event_callback->ValueChanged(w, v);
158 case eTextEdit: m_event_callback->ValueChanged(w, -1);
break;
162 m_event_callback->ValueChanged(w, v);
168 m_event_callback->ValueChanged(w, v);
175 m_event_callback->MouseDown(w, params[0], params[1], params[2]);
179 m_event_callback->MouseUp(w, params[0], params[1], params[2]);
183 m_event_callback->MouseMove(w, params[0], params[1]);
187 m_event_callback->KeyDown(w, params[0]);
191 m_event_callback->KeyUp(w, params[0]);
215 if (!m_cocoa_main_window)
216 printf(
"error: couldn't create Cocoa main window\n");
218 m_event_callback = NULL;
223 int s = m_widgets.size();
225 for (
int i = 0; i <
s; i++)
233 m_cocoa_main_window = NULL;
241 FixPosition(x, y, width, height);
253 m_widgets.push_back(widget);
266 FixPosition(x, y, width, height);
276 m_widgets.push_back(widget);
288 FixPosition(x, y, width, height);
298 m_widgets.push_back(widget);
310 FixPosition(x, y, width, height);
320 m_widgets.push_back(widget);
332 FixPosition(x, y, width, height);
342 m_widgets.push_back(widget);
354 FixPosition(x, y, width, height);
356 void* ptr =
CocoaCreateSlider(m_cocoa_main_window, x, y, width, height, min_value, max_value, step, value, (w != NULL ? w->
cocoa_ptr : NULL));
364 m_widgets.push_back(widget);
376 FixPosition(x, y, width, height);
378 void* ptr =
CocoaCreateComboBox(m_cocoa_main_window, x, y, width, height, num_entries, entries, current_entry, (w != NULL ? w->
cocoa_ptr : NULL));
386 m_widgets.push_back(widget);
399 FixPosition(x, y, width, height);
409 m_widgets.push_back(widget);
462 printf(
"error: CCocoaMainWindow::SetImage: image dimensions do not match dimensions of image widget!\n");
596 y = m_height - y -
height;
bool MakeCurrentGLWidget(WIDGET_HANDLE widget)
void CocoaGetTitle(void *ptr, char *str, int len)
void CocoaSetTitle(void *ptr, const char *str)
bool SetText(WIDGET_HANDLE widget, const char *text)
GLenum const GLfloat * params
bool SetValue(WIDGET_HANDLE widget, int value)
WIDGET_HANDLE AddComboBox(int x, int y, int width, int height, int num_entries, const char **entries, int current_entry, WIDGET_HANDLE parent=0)
void EventCallback(void *window, void *widget, int type, int *params)
bool SwapBuffersGLWidget(WIDGET_HANDLE widget)
int GetModifierKeyState()
void CocoaSetImage(void *ptr, int width, int height, unsigned char *pixels)
WIDGET_HANDLE AddGLWidget(int x, int y, int width, int height, WIDGET_HANDLE parent=0)
WIDGET_HANDLE AddButton(int x, int y, int width, int height, const char *text, WIDGET_HANDLE parent=0)
int width
The width of the image in pixels.
void * CocoaCreateImage(void *window, int x, int y, int width, int height, void *ptr)
WIDGET_HANDLE AddSlider(int x, int y, int width, int height, int min_value, int max_value, int step, int value, WIDGET_HANDLE parent=0)
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
void CocoaDestroyMainWindow(void *window)
void CocoaShow(void *ptr)
GLuint GLuint GLsizei GLenum type
unsigned char * pixels
The pointer to the the pixels.
bool ConvertImage(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bFast=false, const MyRegion *pROI=0)
Converts a grayscale CByteImage to an RGB CByteImage image and vice versa.
void * CocoaCreateMainWindow(int x, int y, int width, int height, const char *title, void *main_window_ptr)
void CocoaHide(void *ptr)
int CocoaGetComboBoxSelection(void *ptr)
void EventCallback(void *widget, int type, int *params)
void CocoaSetInt(void *ptr, int value)
void * CocoaCreateTextEdit(void *window, int x, int y, int width, int height, const char *text, void *ptr)
void CocoaSwapBuffers(void *ptr)
WIDGET_HANDLE AddCheckBox(int x, int y, int width, int height, const char *text, bool checked, WIDGET_HANDLE parent=0)
void CocoaShowWindow(void *ptr)
WIDGET_HANDLE AddImage(int x, int y, int width, int height, WIDGET_HANDLE parent=0)
void CocoaSetComboBoxSelection(void *ptr, int value)
GLsizei const GLfloat * value
void * CocoaCreateOpenGLWidget(void *window, int x, int y, int width, int height, void *ptr)
void * CocoaCreateComboBox(void *window, int x, int y, int width, int height, int num_entries, const char **entries, int current_entry, void *ptr)
bool GetValue(WIDGET_HANDLE widget, int &value)
void CocoaGetText(void *ptr, char *str, int len)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
void Hide(WIDGET_HANDLE widget=0)
int height
The height of the image in pixels.
void * CocoaCreateSlider(void *window, int x, int y, int width, int height, int min_value, int max_value, int step, int value, void *ptr)
CCocoaMainWindow(int x, int y, int width, int height, const char *title)
GLenum GLsizei GLsizei height
int CocoaGetModifierKeyState()
ImageType type
The type of the image.
WIDGET_HANDLE AddLabel(int x, int y, int width, int height, const char *text, WIDGET_HANDLE parent=0)
void * CocoaCreateCheckBox(void *window, int x, int y, int width, int height, const char *text, bool checked, void *ptr)
void CocoaGetCurrentWorkingDirectory(char *str, int len)
int CocoaGetInt(void *ptr)
bool GetText(WIDGET_HANDLE widget, char *text, int len)
void FixPosition(int &x, int &y, int &width, int &height)
void CocoaSetText(void *ptr, const char *str)
void CocoaMakeCurrent(void *ptr)
void Show(WIDGET_HANDLE widget=0)
void * CocoaCreateLabel(void *window, int x, int y, int width, int height, const char *text, void *ptr)
bool SetImage(WIDGET_HANDLE widget, const CByteImage *pImage)
GLubyte GLubyte GLubyte GLubyte w
void CocoaHideWindow(void *ptr)
void * CocoaCreateButton(void *window, int x, int y, int width, int height, const char *text, void *ptr)
WIDGET_HANDLE AddTextEdit(int x, int y, int width, int height, const char *text, WIDGET_HANDLE parent=0)