Added Carbon event handling for Mac OS X gaining support for the
Mose Wheel, Key Modifiers, etc. . Added some documentation (please check: English is not my native language) Changed line pattern to look a little nicer. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1835 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
96d499704a
commit
0ee1fb7b1b
2
CHANGES
2
CHANGES
@ -1,5 +1,7 @@
|
||||
CHANGES IN FLTK 1.1.0b7
|
||||
|
||||
- Mac OS X uses mostly Carbon event handling to support
|
||||
Mousewheel, three buttons, all modifier keys, etc.
|
||||
- More documentation updates...
|
||||
- Mac OS X support works 95%
|
||||
- Updated paragraph 4 of the FLTK license exceptions;
|
||||
|
@ -141,7 +141,7 @@ values. These are mapped to the closest color supported by the
|
||||
screen, either from one of the 256 colors in the FLTK 1.0.x
|
||||
colormap or a direct RGB value on TrueColor screens. You can
|
||||
generate 24-bit RGB color values using the <A
|
||||
HREF="functions.html#fl_rgb_color"><TT>fl_rgb_color()</TT>
|
||||
HREF="functions.html#fl_rgb_color"><TT>fl_rgb_color()</TT></A>
|
||||
function.
|
||||
|
||||
<H4>void fl_color(Fl_Color)</H4>
|
||||
@ -770,7 +770,7 @@ for example.
|
||||
<H4>virtual void copy();<BR>
|
||||
virtual void copy(int w, int h);</H4>
|
||||
|
||||
<P>The <TT>copy() method creates a copy of the image. The second form
|
||||
<P>The <TT>copy()</TT> method creates a copy of the image. The second form
|
||||
specifies the new size of the image - the image is resized using the
|
||||
nearest-neighbor algorithm.
|
||||
|
||||
|
@ -98,12 +98,12 @@ is now included with several Linux distributions.</P>
|
||||
<LI>The FLUID program (which includes every widget) is
|
||||
538k.</LI>
|
||||
|
||||
<LI>Written directly atop Xlib (or WIN32) for maximum
|
||||
<LI>Written directly atop core libraries (Xlib, WIN32 or Carbon) for maximum
|
||||
speed, and carefully optimized for code size and
|
||||
performance.</LI>
|
||||
|
||||
<LI>Precise low-level compatability between the X11 and
|
||||
WIN32 version - only about 10% of the code is
|
||||
<LI>Precise low-level compatability between the X11,
|
||||
WIN32 and MacOS version - only about 10% of the code is
|
||||
different.</LI>
|
||||
|
||||
<LI>Interactive user interface builder program. Output is
|
||||
@ -113,7 +113,7 @@ is now included with several Linux distributions.</P>
|
||||
is available.</LI>
|
||||
|
||||
<LI>Very small & fast portable 2-D drawing library
|
||||
to hide Xlib and WIN32.</LI>
|
||||
to hide Xlib, WIN32 or QuickDraw.</LI>
|
||||
|
||||
<LI>OpenGL/Mesa drawing area widget.</LI>
|
||||
|
||||
|
@ -373,4 +373,36 @@ feature, not a bug. </P>
|
||||
<P><TT>SetCapture</TT> (used by <TT>Fl::grab()</TT>) doesn't work, and
|
||||
the main window title bar turns gray while menus are popped up. </P>
|
||||
<P>FLUID does not support BMP files yet. </P>
|
||||
|
||||
<H2>MacOS-specific interface</h2>
|
||||
FLTK supports MacOS 8.6, MacOS 9 and Mac OS X using the Apple Carbon library.
|
||||
When compiled with MPW or MetroWerks' CodeWarrior, application binaries in CFM format will
|
||||
run on all the above systems without changes.
|
||||
OS X's 'gcc' however creates Mach-O binaries which are not supported by
|
||||
MacOS 9 and earlier.
|
||||
<br>
|
||||
<PRE>#include <FL/x.H></PRE>
|
||||
The <tt><FL/x.H></tt> header file defines the interface to FLTK's MacOS-specific
|
||||
functions. Be warned that some of the structures and calls in it are
|
||||
subject to change in future version of FLTK. Try to avoid doing this
|
||||
so your code is portable.
|
||||
<H4>WindowRef fl_xid(const Fl_Window *)</h4>
|
||||
Returns the window reference for an <tt>Fl_Window</tt>, or NULL if not shown.
|
||||
<h4>Fl_Window *fl_find(WindowRef xid)</h4>
|
||||
Return the <tt>Fl_Window</tt> that corresponds to the give window hande, or NULL if not found. FLTK Windows that are children of top-level windows share the WindowRef
|
||||
with the top-level window.
|
||||
<h3>Drawing Things Using QuickDraw</h3>
|
||||
When the virtual function <tt>Fl_Widget::draw()</tt> is called, FLTK has prepared
|
||||
the Window and CGrafPort for drawing. Clipping and offsets are prepared to allow
|
||||
correct subwindow drawing.
|
||||
<br><br>
|
||||
OS X doublebuffers all windows automatically. On OS X <tt>Fl_Window</tt> and
|
||||
<tt>Fl_Double_Window</tt> are handled internally in the same way.
|
||||
<h3>Mac File System Specifics</h3>
|
||||
<h4>Resource Forks</h4>
|
||||
FLTK does not access the resource fork of an application. However, a minimal
|
||||
resource fork must be created for OS 8 and OS X applications.
|
||||
<h4>Mac File Paths</h4>
|
||||
FLTK uses Unix-style filenames and paths.
|
||||
|
||||
</BODY></HTML>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<P>This manual describes the Fast Light Tool Kit ("FLTK")
|
||||
version 1.1.0, a C++ Graphical User Interface
|
||||
("GUI") toolkit for UNIX and Microsoft Windows. Each
|
||||
("GUI") toolkit for UNIX, Microsoft Windows and MacOS. Each
|
||||
of the chapters in this manual is designed as a tutorial for
|
||||
using FLTK, while the appendices provide a convenient reference
|
||||
for all FLTK widgets, functions, and operating system
|
||||
@ -88,6 +88,9 @@ interfaces.</P>
|
||||
<DT>WIN32</DT>
|
||||
<DD>The Microsoft Windows 32-bit Application Programmer's Interface.</DD>
|
||||
|
||||
<DT>MacOS</DT>
|
||||
<DD>The Apple Macintosh OS 8.6 and later, including OS X.<DD>
|
||||
|
||||
</DL>
|
||||
|
||||
<H2>Copyrights and Trademarks</H2>
|
||||
@ -98,7 +101,8 @@ License, located in <A HREF="license.html#license">Appendix G</A>.</P>
|
||||
|
||||
<P>UNIX is a registered trademark of the X Open Group, Inc. Microsoft
|
||||
and Windows are registered trademarks of Microsoft Corporation. OpenGL
|
||||
is a registered trademark of Silicon Graphics, Inc. </P>
|
||||
is a registered trademark of Silicon Graphics, Inc. . Apple, Macintosh,
|
||||
MacOS and Mac OS X are registered trademarks of Apple Computer, Inc. .</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_grab.cxx,v 1.1.2.4.2.2 2001/11/27 17:44:06 easysw Exp $"
|
||||
// "$Id: Fl_grab.cxx,v 1.1.2.4.2.3 2001/12/12 07:50:37 matthiaswm Exp $"
|
||||
//
|
||||
// Grab/release code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -51,7 +51,7 @@ void Fl::grab(Fl_Window* w) {
|
||||
SetActiveWindow(fl_capture = fl_xid(first_window()));
|
||||
SetCapture(fl_capture);
|
||||
#elif defined(__APPLE__)
|
||||
//++
|
||||
BeginAppModalStateForWindow( fl_xid(first_window()) );
|
||||
#else
|
||||
XGrabPointer(fl_display,
|
||||
fl_xid(first_window()),
|
||||
@ -78,7 +78,7 @@ void Fl::grab(Fl_Window* w) {
|
||||
fl_capture = 0;
|
||||
ReleaseCapture();
|
||||
#elif defined(__APPLE__)
|
||||
//++
|
||||
EndAppModalStateForWindow( fl_xid(first_window()) );
|
||||
#else
|
||||
XUngrabKeyboard(fl_display, fl_event_time);
|
||||
XUngrabPointer(fl_display, fl_event_time);
|
||||
@ -93,5 +93,5 @@ void Fl::grab(Fl_Window* w) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_grab.cxx,v 1.1.2.4.2.2 2001/11/27 17:44:06 easysw Exp $".
|
||||
// End of "$Id: Fl_grab.cxx,v 1.1.2.4.2.3 2001/12/12 07:50:37 matthiaswm Exp $".
|
||||
//
|
||||
|
292
src/Fl_mac.cxx
292
src/Fl_mac.cxx
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_mac.cxx,v 1.1.2.3 2001/12/06 00:17:47 matthiaswm Exp $"
|
||||
// "$Id: Fl_mac.cxx,v 1.1.2.4 2001/12/12 07:50:37 matthiaswm Exp $"
|
||||
//
|
||||
// MacOS specific code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -28,8 +28,6 @@
|
||||
// still be useful.
|
||||
#define CONSOLIDATE_MOTION 0
|
||||
|
||||
// use TARGET_API_MAC_CARBON if needed
|
||||
|
||||
#include <config.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
@ -41,7 +39,14 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef TARGET_API_MAC_CARBON
|
||||
// use the above define if you want to use full Carbon API
|
||||
// - this will change event handling to Carbon Events
|
||||
#endif
|
||||
|
||||
static unsigned short macKeyLookUp[];
|
||||
static Fl_Window* resize_from_system;
|
||||
Fl_Window* fl_find(Window);
|
||||
int fl_handle(const EventRecord &event);
|
||||
|
||||
int fl_screen;
|
||||
@ -213,13 +218,33 @@ static double do_queued_events( double time = 0.0 )
|
||||
// SetRectRgn(rgn, ev.where.h, ev.where.v, ev.where.h+1, ev.where.v+1 );
|
||||
}
|
||||
#else
|
||||
#ifdef TARGET_API_MAC_CARBON
|
||||
OSStatus ret;
|
||||
EventRef ev;
|
||||
static EventTargetRef target = 0;
|
||||
if ( !target ) target = GetEventDispatcherTarget();
|
||||
ret = ReceiveNextEvent( 0, NULL, time, true, &ev );
|
||||
if ( ret == noErr )
|
||||
{
|
||||
ret = SendEventToEventTarget( ev, target );
|
||||
if ( ret == eventNotHandledErr )
|
||||
{
|
||||
EventRecord er;
|
||||
if ( ConvertEventRefToEventRecord( ev, &er ) )
|
||||
fl_handle( er );
|
||||
}
|
||||
ReleaseEvent( ev );
|
||||
}
|
||||
|
||||
#else
|
||||
EventRecord ev;
|
||||
unsigned long ticks = (int)(time*60.0);
|
||||
unsigned long ticks = (int)(time*60.0); // setting ticks to 7fffffff will wait forever
|
||||
if ( WaitNextEvent(everyEvent, &ev, ticks, rgn) )
|
||||
{
|
||||
fl_handle(ev); //: handle the nullEvent to get mouse up events
|
||||
SetRectRgn(rgn, ev.where.h, ev.where.v, ev.where.h+1, ev.where.v+1 );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONSOLIDATE_MOTION
|
||||
@ -315,7 +340,180 @@ static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* repl
|
||||
return noErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Carbon Mousewheel handler
|
||||
* This needs to be linked into all new window event handlers
|
||||
*/
|
||||
OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
|
||||
{
|
||||
Fl_Window *window = (Fl_Window*)userData;
|
||||
EventMouseWheelAxis axis;
|
||||
GetEventParameter( event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(EventMouseWheelAxis), NULL, &axis );
|
||||
long delta;
|
||||
GetEventParameter( event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(long), NULL, &delta );
|
||||
if ( axis == kEventMouseWheelAxisY )
|
||||
{
|
||||
Fl::e_dy = - delta;
|
||||
if ( Fl::e_dy) Fl::handle( FL_MOUSEWHEEL, window );
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert the current mouse chord into the FLTK modifier state
|
||||
*/
|
||||
static void chord_to_e_state( UInt32 chord )
|
||||
{
|
||||
static ulong state[] =
|
||||
{
|
||||
0, FL_BUTTON1, FL_BUTTON3, FL_BUTTON1|FL_BUTTON3, FL_BUTTON2,
|
||||
FL_BUTTON2|FL_BUTTON1, FL_BUTTON2|FL_BUTTON3, FL_BUTTON2|FL_BUTTON1|FL_BUTTON3
|
||||
};
|
||||
Fl::e_state = ( Fl::e_state & 0xff0000 ) | state[ chord & 0x07 ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Carbon Mouse Button Handler
|
||||
*/
|
||||
OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
|
||||
{
|
||||
static int keysym[] = { 0, FL_Button+1, FL_Button+3, FL_Button+2 };
|
||||
static int px, py;
|
||||
Fl_Window *window = (Fl_Window*)userData;
|
||||
Point pos;
|
||||
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &pos );
|
||||
EventMouseButton btn;
|
||||
GetEventParameter( event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &btn );
|
||||
UInt32 clickCount;
|
||||
GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL, sizeof(UInt32), NULL, &clickCount );
|
||||
UInt32 chord;
|
||||
GetEventParameter( event, kEventParamMouseChord, typeUInt32, NULL, sizeof(UInt32), NULL, &chord );
|
||||
WindowRef xid = fl_xid(window);
|
||||
int sendEvent = 0;
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventMouseDown:
|
||||
if ( btn==kEventMouseButtonPrimary && FindWindow( pos, &xid )!=inContent )
|
||||
return CallNextEventHandler( nextHandler, event ); // we won't handle this. The OS should do that.
|
||||
if (xid!=FrontWindow()) SelectWindow( xid ); //{ SelectWindow(xid); return 1; } // do we want to keep this?!
|
||||
sendEvent = FL_PUSH;
|
||||
Fl::e_is_click = 1; px = pos.h; py = pos.v;
|
||||
Fl::e_clicks = clickCount;
|
||||
// fall through
|
||||
case kEventMouseUp:
|
||||
if (!window) break;
|
||||
if ( !sendEvent ) sendEvent = FL_RELEASE;
|
||||
Fl::e_keysym = keysym[ btn ];
|
||||
// fall through
|
||||
case kEventMouseMoved:
|
||||
if ( !sendEvent ) { sendEvent = FL_MOVE; chord = 0; }
|
||||
// fall through
|
||||
case kEventMouseDragged:
|
||||
if ( !sendEvent ) {
|
||||
sendEvent = FL_DRAG;
|
||||
if (abs(pos.h-px)>5 || abs(pos.v-py)>5) Fl::e_is_click = 0;
|
||||
}
|
||||
chord_to_e_state( chord );
|
||||
SetPort( GetWindowPort(xid) ); SetOrigin(0, 0);
|
||||
Fl::e_x_root = pos.h;
|
||||
Fl::e_y_root = pos.v;
|
||||
GlobalToLocal( &pos );
|
||||
Fl::e_x = pos.h;
|
||||
Fl::e_y = pos.v;
|
||||
Fl::handle( sendEvent, window );
|
||||
break;
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert the current mouse chord into the FLTK modifier state
|
||||
*/
|
||||
static void mods_to_e_state( UInt32 mods )
|
||||
{
|
||||
long state = 0;
|
||||
if ( mods & kEventKeyModifierNumLockMask ) state |= FL_NUM_LOCK;
|
||||
if ( mods & cmdKey ) state |= FL_CTRL;
|
||||
if ( mods & (optionKey|rightOptionKey) ) state |= FL_ALT;
|
||||
if ( mods & (controlKey|rightControlKey) ) state |= FL_META;
|
||||
if ( mods & (shiftKey|rightShiftKey) ) state |= FL_SHIFT;
|
||||
if ( mods & alphaLock ) state |= FL_CAPS_LOCK;
|
||||
Fl::e_state = ( Fl::e_state & 0xff000000 ) | state;
|
||||
//printf( "State 0x%08x (%04x)\n", Fl::e_state, mods );
|
||||
}
|
||||
|
||||
/**
|
||||
* convert the current mouse chord into the FLTK keysym
|
||||
*/
|
||||
static void mods_to_e_keysym( UInt32 mods )
|
||||
{
|
||||
if ( mods & cmdKey ) Fl::e_keysym = FL_Control_L;
|
||||
//else if ( mods & kEventKeyModifierNumLockMask ) Fl::e_keysym = FL_Num_Lock;
|
||||
else if ( mods & optionKey ) Fl::e_keysym = FL_Alt_L;
|
||||
else if ( mods & rightOptionKey ) Fl::e_keysym = FL_Alt_R;
|
||||
else if ( mods & controlKey ) Fl::e_keysym = FL_Meta_L;
|
||||
else if ( mods & rightControlKey ) Fl::e_keysym = FL_Meta_R;
|
||||
else if ( mods & shiftKey ) Fl::e_keysym = FL_Shift_L;
|
||||
else if ( mods & rightShiftKey ) Fl::e_keysym = FL_Shift_R;
|
||||
else if ( mods & alphaLock ) Fl::e_keysym = FL_Caps_Lock;
|
||||
else Fl::e_keysym = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* handle carbon keyboard events
|
||||
*/
|
||||
OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
|
||||
{
|
||||
static char buffer[5];
|
||||
int sendEvent = 0;
|
||||
Fl_Window *window = (Fl_Window*)userData;
|
||||
UInt32 mods;
|
||||
static UInt32 prevMods = 0xdeadbeef;
|
||||
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &mods );
|
||||
if ( prevMods == 0xdeadbeef ) prevMods = mods;
|
||||
UInt32 keyCode;
|
||||
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
||||
char key;
|
||||
GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key );
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventRawKeyDown:
|
||||
case kEventRawKeyRepeat:
|
||||
sendEvent = FL_KEYBOARD;
|
||||
// fall through
|
||||
case kEventRawKeyUp:
|
||||
if ( !sendEvent ) sendEvent = FL_KEYUP;
|
||||
Fl::e_keysym = macKeyLookUp[ keyCode & 0x7f ];
|
||||
if ( key=='\t' || key==27 || key>=32 )
|
||||
{
|
||||
buffer[0] = key;
|
||||
Fl::e_length = 1;
|
||||
} else {
|
||||
buffer[0] = 0;
|
||||
Fl::e_length = 0;
|
||||
}
|
||||
Fl::e_text = buffer;
|
||||
// insert UnicodeHandling right here!
|
||||
break;
|
||||
case kEventRawKeyModifiersChanged: {
|
||||
UInt32 tMods = prevMods ^ mods;
|
||||
if ( tMods )
|
||||
{
|
||||
mods_to_e_keysym( tMods );
|
||||
if ( Fl::e_keysym )
|
||||
sendEvent = ( prevMods<mods ) ? FL_KEYBOARD : FL_KEYUP;
|
||||
Fl::e_length = 0;
|
||||
buffer[0] = 0;
|
||||
prevMods = mods;
|
||||
}
|
||||
mods_to_e_state( mods );
|
||||
break; }
|
||||
}
|
||||
while (window->parent()) window = window->window();
|
||||
if (sendEvent && Fl::handle(sendEvent,window)) return noErr;
|
||||
return noErr; // for testing
|
||||
return CallNextEventHandler( nextHandler, event );;
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize the Mac toolboxes and set the default menubar
|
||||
@ -533,7 +731,7 @@ unsigned short mac2fltk(ulong macKey)
|
||||
*/
|
||||
static inline void checkdouble()
|
||||
{
|
||||
if (Fl::e_is_click == Fl::e_keysym)
|
||||
if (Fl::e_is_click == Fl::e_keysym)
|
||||
Fl::e_clicks++;
|
||||
else {
|
||||
Fl::e_clicks = 0;
|
||||
@ -544,10 +742,6 @@ static inline void checkdouble()
|
||||
ptime = fl_event_time;
|
||||
}
|
||||
|
||||
/************************** Mac Window System stuff ***********************/
|
||||
|
||||
static Fl_Window* resize_from_system;
|
||||
Fl_Window* fl_find(Window);
|
||||
|
||||
|
||||
/**
|
||||
@ -687,7 +881,7 @@ int fl_handle(const EventRef event)
|
||||
eventkind = GetEventKind(event);
|
||||
memcpy(buffer, &eventclass, 4);
|
||||
buffer[4] = '\0';
|
||||
printf("fl_event(): class = %s, kind = %ld\n", buffer, eventkind);
|
||||
//printf("fl_event(): class = %s, kind = %ld\n", buffer, eventkind);
|
||||
}
|
||||
#else
|
||||
int fl_handle(const EventRecord &macevent)
|
||||
@ -702,7 +896,7 @@ int fl_handle(const EventRecord &macevent)
|
||||
switch (macevent.what)
|
||||
{
|
||||
case mouseDown: {
|
||||
// handle the differnt mouseDown events in various areas of the screen
|
||||
// handle the different mouseDown events in various areas of the screen
|
||||
int part = FindWindow(macevent.where, &xid);
|
||||
//printf("mousedown in part %d\n", part );
|
||||
prevMouseDownXid = xid;
|
||||
@ -792,7 +986,7 @@ int fl_handle(const EventRecord &macevent)
|
||||
break;
|
||||
case updateEvt:
|
||||
xid = (WindowPtr)macevent.message;
|
||||
handleUpdateEvent( xid );
|
||||
if (xid) handleUpdateEvent( xid );
|
||||
break;
|
||||
case diskEvt:
|
||||
break;
|
||||
@ -975,22 +1169,6 @@ void Fl_X::make(Fl_Window* w)
|
||||
}
|
||||
}
|
||||
int xwm = xp, ywm = yp, bt, bx, by;
|
||||
// classes:
|
||||
// kAlertWindowClass: small up frame - nice
|
||||
// kModalWindowClass: as above
|
||||
// kFloatingWindowClass: does not deactivate app window, but has small title bar (medium decoration)
|
||||
// kDocumentWindowClass: transparent huge upper title (large decoration) -- last standard definition
|
||||
// kUtilityWindowClass: like 'floating (small decoration)
|
||||
// kHelpWindowClass: perfect: no decoration, keeps master active, stays on top of ALL windows, not modal though
|
||||
// kSheetWindowClass: no deco, deactivates parent
|
||||
// kToolbarWindowClass: no deco, passive, under other menues
|
||||
// kPlainWindowClass: no deco, active, under
|
||||
// kOverlayWindowClass: invisible!
|
||||
// kSheetAlertWindowClass: no deco, active, under
|
||||
// kAltPlainWindowClass: no deco, active, under
|
||||
// attributes:
|
||||
// kWindowCloseBoxAttribute, HorizontalZoom, VerticalZoom, FullZoom, CollapsBox, Resizable,
|
||||
// SideTitlebar(floatin only), NoUpdates, NoActivates, Macros: StandardDocument, StandardFloating
|
||||
if (!fake_X_wm(w, xwm, ywm, bt, bx, by))
|
||||
{ winclass = kHelpWindowClass; winattr = 0; }
|
||||
else if (w->modal())
|
||||
@ -1048,6 +1226,42 @@ void Fl_X::make(Fl_Window* w)
|
||||
Fl_X::first = x;
|
||||
if (w->resizable()) DrawGrowIcon(x->xid);
|
||||
w->set_visible();
|
||||
// add event handlers
|
||||
#ifdef TARGET_API_MAC_CARBON
|
||||
{ // Install Carbon Event handlers
|
||||
OSStatus ret;
|
||||
EventHandlerUPP mousewheelHandler = NewEventHandlerUPP( carbonMousewheelHandler ); // will not be disposed by Carbon...
|
||||
EventTypeSpec mousewheelEvents[1];
|
||||
mousewheelEvents[0].eventClass = kEventClassMouse;
|
||||
mousewheelEvents[0].eventKind = kEventMouseWheelMoved;
|
||||
ret = InstallWindowEventHandler( x->xid, mousewheelHandler, 2, mousewheelEvents, w, 0L );
|
||||
EventHandlerUPP mouseHandler = NewEventHandlerUPP( carbonMouseHandler ); // will not be disposed by Carbon...
|
||||
EventTypeSpec mouseEvents[4];
|
||||
mouseEvents[0].eventClass = kEventClassMouse;
|
||||
mouseEvents[0].eventKind = kEventMouseDown;
|
||||
mouseEvents[1].eventClass = kEventClassMouse;
|
||||
mouseEvents[1].eventKind = kEventMouseUp;
|
||||
mouseEvents[2].eventClass = kEventClassMouse;
|
||||
mouseEvents[2].eventKind = kEventMouseMoved;
|
||||
mouseEvents[3].eventClass = kEventClassMouse;
|
||||
mouseEvents[3].eventKind = kEventMouseDragged;
|
||||
ret = InstallWindowEventHandler( x->xid, mouseHandler, 4, mouseEvents, w, 0L );
|
||||
EventHandlerUPP keyboardHandler = NewEventHandlerUPP( carbonKeyboardHandler ); // will not be disposed by Carbon...
|
||||
EventTypeSpec keyboardEvents[4];
|
||||
keyboardEvents[0].eventClass = kEventClassKeyboard;
|
||||
keyboardEvents[0].eventKind = kEventRawKeyDown;
|
||||
keyboardEvents[1].eventClass = kEventClassKeyboard;
|
||||
keyboardEvents[1].eventKind = kEventRawKeyRepeat;
|
||||
keyboardEvents[2].eventClass = kEventClassKeyboard;
|
||||
keyboardEvents[2].eventKind = kEventRawKeyUp;
|
||||
keyboardEvents[3].eventClass = kEventClassKeyboard;
|
||||
keyboardEvents[3].eventKind = kEventRawKeyModifiersChanged;
|
||||
ret = InstallWindowEventHandler( x->xid, keyboardHandler, 4, keyboardEvents, w, 0L );
|
||||
//EventTargetRef winTarget = GetWindowEventTarget( x->xid );
|
||||
//InstallStandardEventHandler( winTarget ); // it would be useful to call this, but we must make sure that ALL other events are Carbonized first
|
||||
}
|
||||
#endif
|
||||
|
||||
w->handle(FL_SHOW);
|
||||
w->redraw(); // force draw to happen
|
||||
//TransitionWindow( x->xid, kWindowZoomTransitionEffect, kWindowShowTransitionAction, 0 );
|
||||
@ -1265,9 +1479,29 @@ DoMyOperation();
|
||||
endTime = UpTime();
|
||||
elapsedTime = SubAbsoluteFromAbsolute(endTime, startTime);
|
||||
elapsedNanoseconds = AbsoluteToNanoseconds(elapsedTime);
|
||||
|
||||
------ window classes:
|
||||
// classes:
|
||||
// kAlertWindowClass: small up frame - nice
|
||||
// kModalWindowClass: as above
|
||||
// kFloatingWindowClass: does not deactivate app window, but has small title bar (medium decoration)
|
||||
// kDocumentWindowClass: transparent huge upper title (large decoration) -- last standard definition
|
||||
// kUtilityWindowClass: like 'floating (small decoration)
|
||||
// kHelpWindowClass: perfect: no decoration, keeps master active, stays on top of ALL windows, not modal though
|
||||
// kSheetWindowClass: no deco, deactivates parent
|
||||
// kToolbarWindowClass: no deco, passive, under other menues
|
||||
// kPlainWindowClass: no deco, active, under
|
||||
// kOverlayWindowClass: invisible!
|
||||
// kSheetAlertWindowClass: no deco, active, under
|
||||
// kAltPlainWindowClass: no deco, active, under
|
||||
// attributes:
|
||||
// kWindowCloseBoxAttribute, HorizontalZoom, VerticalZoom, FullZoom, CollapsBox, Resizable,
|
||||
// SideTitlebar(floatin only), NoUpdates, NoActivates, Macros: StandardDocument, StandardFloating
|
||||
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_mac.cxx,v 1.1.2.3 2001/12/06 00:17:47 matthiaswm Exp $".
|
||||
// End of "$Id: Fl_mac.cxx,v 1.1.2.4 2001/12/12 07:50:37 matthiaswm Exp $".
|
||||
//
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_line_style.cxx,v 1.3.2.3.2.7 2001/12/07 16:28:38 easysw Exp $"
|
||||
// "$Id: fl_line_style.cxx,v 1.3.2.3.2.8 2001/12/12 07:50:37 matthiaswm Exp $"
|
||||
//
|
||||
// Line style code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -58,8 +58,8 @@ void fl_line_style(int style, int width, char* dashes) {
|
||||
// QuickDraw supports pen size and pattern, but no arbitrary line styles.
|
||||
static Pattern styles[] = {
|
||||
{ { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }, // FL_SOLID
|
||||
{ { 0xcc, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0x00, 0x00 } }, // FL_DASH
|
||||
{ { 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00 } } // FL_DOT
|
||||
{ { 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f } }, // FL_DASH
|
||||
{ { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } } // FL_DOT
|
||||
};
|
||||
|
||||
if (!width) width = 1;
|
||||
@ -104,5 +104,5 @@ void fl_line_style(int style, int width, char* dashes) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.7 2001/12/07 16:28:38 easysw Exp $".
|
||||
// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.8 2001/12/12 07:50:37 matthiaswm Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user