69
71
WindowRef ugly_hack=NULL;
73
const EventTypeSpec kWEvents[] = {
74
{ kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
77
static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData) {
79
GHOST_WindowCarbon *ghost_window;
83
if (::GetEventKind(event) == kEventWindowZoom) {
84
err = ::GetEventParameter (event,kEventParamDirectObject,typeWindowRef,NULL,sizeof(mywindow),NULL, &mywindow);
85
ghost_window = (GHOST_WindowCarbon *) GetWRefCon(mywindow);
86
theState = ghost_window->getMac_windowState();
88
ghost_window->setMac_windowState(2);
89
else if (theState == 2)
90
ghost_window->setMac_windowState(1);
93
return eventNotHandledErr;
71
96
GHOST_WindowCarbon::GHOST_WindowCarbon(
72
97
const STR_String& title,
86
111
m_fullScreenDirty(false)
116
//fprintf(stderr," main screen top %i left %i height %i width %i\n", top, left, height, width);
118
if (state >= GHOST_kWindowState8Normal ) {
119
if(state == GHOST_kWindowState8Normal) state= GHOST_kWindowStateNormal;
120
else if(state == GHOST_kWindowState8Maximized) state= GHOST_kWindowStateMaximized;
121
else if(state == GHOST_kWindowState8Minimized) state= GHOST_kWindowStateMinimized;
122
else if(state == GHOST_kWindowState8FullScreen) state= GHOST_kWindowStateFullScreen;
124
// state = state - 8; this was the simple version of above code, doesnt work in gcc 4.0
126
setMac_windowState(1);
128
setMac_windowState(0);
90
130
if (state != GHOST_kWindowStateFullScreen) {
91
131
Rect bnds = { top, left, top+height, left+width };
92
Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized);
132
// Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized); /*unused*/
93
133
gen2mac(title, title255);
95
m_windowRef = ::NewCWindow(
97
&bnds, // Bounding rectangle of the window
98
title255, // Title of the window
99
visible, // Window initially visible
100
kWindowFullZoomGrowDocumentProc, //kWindowGrowDocumentProc, // procID
101
(WindowRef)-1L, // Put window before all other windows
102
true, // Window has minimize box
103
(SInt32)this); // Store a pointer to the class in the refCon
135
err = ::CreateNewWindow( kDocumentWindowClass,
136
kWindowStandardDocumentAttributes+kWindowLiveResizeAttribute,
141
fprintf(stderr," error creating window %i \n",err);
144
::SetWRefCon(m_windowRef,(SInt32)this);
146
err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL);
148
fprintf(stderr," error creating handler %i \n",err);
150
// ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
151
::ShowWindow(m_windowRef);
152
::MoveWindow (m_windowRef, left, top,true);
104
156
if (m_windowRef) {
105
157
m_grafPtr = ::GetWindowPort(m_windowRef);
106
158
setDrawingContextType(type);
652
707
GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
653
708
GHOST_TUns8 mask[16][2], int hotX, int hotY)
655
setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*) mask, 16, 16, hotX, hotY, 0, 1);
710
return setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*) mask, 16, 16, hotX, hotY, 0, 1);
714
void GHOST_WindowCarbon::setMac_windowState(short value)
716
mac_windowState = value;
719
short GHOST_WindowCarbon::getMac_windowState()
721
return mac_windowState;