merging cockos wdl
[wdl/wdl-ol.git] / WDL / swell / swell-internal.h
blob62d07ee65c5d3fd0f0c45b971ce346faf7391a06
1 #ifndef _SWELL_INTERNAL_H_
2 #define _SWELL_INTERNAL_H_
4 #include "../ptrlist.h"
6 class SWELL_ListView_Row
8 public:
9 SWELL_ListView_Row() : m_param(0), m_imageidx(0), m_tmp(0) { }
10 ~SWELL_ListView_Row() { m_vals.Empty(true,free); }
11 WDL_PtrList<char> m_vals;
13 LPARAM m_param;
14 int m_imageidx;
15 int m_tmp; // Cocoa uses this temporarily, generic uses it as a mask (1= selected)
19 #ifdef SWELL_TARGET_OSX
21 #if 0
22 // at some point we should enable this and use it in most SWELL APIs that call Cocoa code...
23 #define SWELL_BEGIN_TRY @try {
24 #define SWELL_END_TRY(x) } @catch (NSException *ex) { NSLog(@"SWELL exception in %s:%d :: %@:%@\n",__FILE__,__LINE__,[ex name], [ex reason]); x }
25 #else
26 #define SWELL_BEGIN_TRY
27 #define SWELL_END_TRY(x)
28 #endif
30 #define __SWELL_PREFIX_CLASSNAME3(a,b) a##b
31 #define __SWELL_PREFIX_CLASSNAME2(a,b) __SWELL_PREFIX_CLASSNAME3(a,b)
32 #define __SWELL_PREFIX_CLASSNAME(cname) __SWELL_PREFIX_CLASSNAME2(SWELL_APP_PREFIX,cname)
34 // this defines interfaces to internal swell classes
35 #define SWELL_hwndChild __SWELL_PREFIX_CLASSNAME(_hwnd)
36 #define SWELL_hwndCarbonHost __SWELL_PREFIX_CLASSNAME(_hwndcarbonhost)
38 #define SWELL_ModelessWindow __SWELL_PREFIX_CLASSNAME(_modelesswindow)
39 #define SWELL_ModalDialog __SWELL_PREFIX_CLASSNAME(_dialogbox)
41 #define SWELL_TextField __SWELL_PREFIX_CLASSNAME(_textfield)
42 #define SWELL_ListView __SWELL_PREFIX_CLASSNAME(_listview)
43 #define SWELL_TreeView __SWELL_PREFIX_CLASSNAME(_treeview)
44 #define SWELL_TabView __SWELL_PREFIX_CLASSNAME(_tabview)
45 #define SWELL_ProgressView __SWELL_PREFIX_CLASSNAME(_progind)
46 #define SWELL_TextView __SWELL_PREFIX_CLASSNAME(_textview)
47 #define SWELL_BoxView __SWELL_PREFIX_CLASSNAME(_box)
48 #define SWELL_Button __SWELL_PREFIX_CLASSNAME(_button)
49 #define SWELL_PopUpButton __SWELL_PREFIX_CLASSNAME(_pub)
50 #define SWELL_ComboBox __SWELL_PREFIX_CLASSNAME(_cbox)
52 #define SWELL_StatusCell __SWELL_PREFIX_CLASSNAME(_statuscell)
53 #define SWELL_ListViewCell __SWELL_PREFIX_CLASSNAME(_listviewcell)
54 #define SWELL_ODListViewCell __SWELL_PREFIX_CLASSNAME(_ODlistviewcell)
55 #define SWELL_ODButtonCell __SWELL_PREFIX_CLASSNAME(_ODbuttoncell)
57 #define SWELL_FocusRectWnd __SWELL_PREFIX_CLASSNAME(_drawfocusrectwnd)
59 #define SWELL_DataHold __SWELL_PREFIX_CLASSNAME(_sdh)
60 #define SWELL_ThreadTmp __SWELL_PREFIX_CLASSNAME(_thread)
61 #define SWELL_PopupMenuRecv __SWELL_PREFIX_CLASSNAME(_trackpopupmenurecv)
63 #define SWELL_TimerFuncTarget __SWELL_PREFIX_CLASSNAME(_tft)
66 #define SWELL_Menu __SWELL_PREFIX_CLASSNAME(_menu)
68 #ifdef __OBJC__
71 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
72 typedef int NSInteger;
73 typedef unsigned int NSUInteger;
74 #endif
76 @interface SWELL_Menu : NSMenu
79 -(void)dealloc;
80 - (id)copyWithZone:(NSZone *)zone;
81 @end
83 @interface SWELL_DataHold : NSObject
85 void *m_data;
87 -(id) initWithVal:(void *)val;
88 -(void *) getValue;
89 @end
91 @interface SWELL_TimerFuncTarget : NSObject
93 TIMERPROC m_cb;
94 HWND m_hwnd;
95 UINT_PTR m_timerid;
97 -(id) initWithId:(UINT_PTR)tid hwnd:(HWND)h callback:(TIMERPROC)cb;
98 -(void)SWELL_Timer:(id)sender;
99 @end
101 typedef struct OwnedWindowListRec
103 NSWindow *hwnd;
104 struct OwnedWindowListRec *_next;
105 } OwnedWindowListRec;
107 typedef struct WindowPropRec
109 char *name; // either <64k or a strdup'd name
110 void *data;
111 struct WindowPropRec *_next;
112 } WindowPropRec;
116 struct HTREEITEM__
118 HTREEITEM__();
119 ~HTREEITEM__();
120 bool FindItem(HTREEITEM it, HTREEITEM__ **parOut, int *idxOut);
122 SWELL_DataHold *m_dh;
124 bool m_haschildren;
125 char *m_value;
126 WDL_PtrList<HTREEITEM__> m_children; // only used in tree mode
127 LPARAM m_param;
132 @interface SWELL_TextField : NSTextField
133 - (void)setNeedsDisplay:(BOOL)flag;
134 - (void)setNeedsDisplayInRect:(NSRect)rect;
135 @end
137 @interface SWELL_TabView : NSTabView
139 NSInteger m_tag;
140 id m_dest;
142 @end
144 @interface SWELL_ProgressView : NSProgressIndicator
146 NSInteger m_tag;
148 @end
150 @interface SWELL_ListViewCell : NSTextFieldCell
153 @end
155 @interface SWELL_StatusCell : NSTextFieldCell
157 NSImage *status;
159 @end
161 @interface SWELL_TreeView : NSOutlineView
163 @public
164 bool m_fakerightmouse;
165 LONG style;
166 WDL_PtrList<HTREEITEM__> *m_items;
167 NSColor *m_fgColor;
168 NSMutableArray *m_selColors;
170 @end
172 @interface SWELL_ListView : NSTableView
174 int m_leftmousemovecnt;
175 bool m_fakerightmouse;
176 @public
177 LONG style;
178 int ownermode_cnt;
179 int m_start_item;
180 int m_start_subitem;
181 int m_start_item_clickmode;
182 int m_lbMode;
183 WDL_PtrList<SWELL_ListView_Row> *m_items;
184 WDL_PtrList<NSTableColumn> *m_cols;
185 WDL_PtrList<HGDIOBJ__> *m_status_imagelist;
186 int m_status_imagelist_type;
187 int m_fastClickMask;
188 NSColor *m_fgColor;
189 NSMutableArray *m_selColors;
191 -(LONG)getSwellStyle;
192 -(void)setSwellStyle:(LONG)st;
193 -(int)getSwellNotificationMode;
194 -(void)setSwellNotificationMode:(int)lbMode;
195 -(int)columnAtPoint:(NSPoint)pt;
196 -(int)getColumnPos:(int)idx; // get current position of column that was originally at idx
197 -(int)getColumnIdx:(int)pos; // get original index of column that is currently at position
198 @end
200 @interface SWELL_ODButtonCell : NSButtonCell
203 @end
205 @interface SWELL_ODListViewCell : NSCell
207 SWELL_ListView *m_ownctl;
208 int m_lastidx;
210 -(void)setOwnerControl:(SWELL_ListView *)t;
211 -(void)setItemIdx:(int)idx;
212 @end
214 @interface SWELL_Button : NSButton
216 void *m_swellGDIimage;
217 LONG_PTR m_userdata;
218 int m_radioflags;
220 -(int)swellGetRadioFlags;
221 -(void)swellSetRadioFlags:(int)f;
222 -(LONG_PTR)getSwellUserData;
223 -(void)setSwellUserData:(LONG_PTR)val;
224 -(void)setSwellGDIImage:(void *)par;
225 -(void *)getSwellGDIImage;
226 @end
228 @interface SWELL_TextView : NSTextView
230 NSInteger m_tag;
232 -(NSInteger) tag;
233 -(void) setTag:(NSInteger)tag;
234 @end
236 @interface SWELL_BoxView : NSBox
238 NSInteger m_tag;
240 -(NSInteger) tag;
241 -(void) setTag:(NSInteger)tag;
242 @end
244 @interface SWELL_FocusRectWnd : NSView
247 @end
249 @interface SWELL_ThreadTmp : NSObject
251 @public
252 void *a, *b;
254 -(void)bla:(id)obj;
255 @end
259 @interface SWELL_hwndChild : NSView // <NSDraggingSource>
261 @public
262 BOOL m_enabled;
263 DLGPROC m_dlgproc;
264 WNDPROC m_wndproc;
265 LONG_PTR m_userdata;
266 LONG_PTR m_extradata[32];
267 NSInteger m_tag;
268 int m_isfakerightmouse;
269 char m_hashaddestroy; // 2 = WM_DESTROY has finished completely
270 HMENU m_menu;
271 BOOL m_flip;
272 bool m_supports_ddrop;
273 bool m_paintctx_used;
274 HDC m_paintctx_hdc;
275 WindowPropRec *m_props;
276 NSRect m_paintctx_rect;
277 BOOL m_isopaque;
278 char m_titlestr[1024];
279 unsigned int m_create_windowflags;
280 NSOpenGLContext *m_glctx;
281 char m_isdirty; // &1=self needs redraw, &2=children may need redraw
282 id m_lastTopLevelOwner; // save a copy of the owner, if any
283 id m_access_cacheptrs[6];
285 - (id)initChild:(SWELL_DialogResourceIndex *)resstate Parent:(NSView *)parent dlgProc:(DLGPROC)dlgproc Param:(LPARAM)par;
286 - (LRESULT)onSwellMessage:(UINT)msg p1:(WPARAM)wParam p2:(LPARAM)lParam;
287 -(HANDLE)swellExtendedDragOp:(id <NSDraggingInfo>)sender retGlob:(BOOL)retG;
288 - (const char *)onSwellGetText;
289 -(void)onSwellSetText:(const char *)buf;
290 -(LONG)swellGetExtendedStyle;
291 -(void)swellSetExtendedStyle:(LONG)st;
292 -(HMENU)swellGetMenu;
293 -(BOOL)swellHasBeenDestroyed;
294 -(void)swellSetMenu:(HMENU)menu;
295 -(LONG_PTR)getSwellUserData;
296 -(void)setSwellUserData:(LONG_PTR)val;
297 -(void)setOpaque:(bool)isOpaque;
298 -(LPARAM)getSwellExtraData:(int)idx;
299 -(void)setSwellExtraData:(int)idx value:(LPARAM)val;
300 -(void)setSwellWindowProc:(WNDPROC)val;
301 -(WNDPROC)getSwellWindowProc;
302 -(void)setSwellDialogProc:(DLGPROC)val;
303 -(DLGPROC)getSwellDialogProc;
305 - (NSArray*) namesOfPromisedFilesDroppedAtDestination:(NSURL*)droplocation;
307 -(void) getSwellPaintInfo:(PAINTSTRUCT *)ps;
308 - (int)swellCapChangeNotify;
309 -(unsigned int)swellCreateWindowFlags;
311 -(bool)swellCanPostMessage;
312 -(int)swellEnumProps:(PROPENUMPROCEX)proc lp:(LPARAM)lParam;
313 -(void *)swellGetProp:(const char *)name wantRemove:(BOOL)rem;
314 -(int)swellSetProp:(const char *)name value:(void *)val ;
317 // NSAccessibility
319 // attribute methods
320 //- (NSArray *)accessibilityAttributeNames;
321 - (id)accessibilityAttributeValue:(NSString *)attribute;
322 //- (BOOL)accessibilityIsAttributeSettable:(NSString *)attribute;
323 //- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute;
325 // parameterized attribute methods
326 //- (NSArray *)accessibilityParameterizedAttributeNames;
327 //- (id)accessibilityAttributeValue:(NSString *)attribute forParameter:(id)parameter;
329 // action methods
330 //- (NSArray *)accessibilityActionNames;
331 //- (NSString *)accessibilityActionDescription:(NSString *)action;
332 //- (void)accessibilityPerformAction:(NSString *)action;
334 // Return YES if the UIElement doesn't show up to the outside world - i.e. its parent should return the UIElement's children as its own - cutting the UIElement out. E.g. NSControls are ignored when they are single-celled.
335 - (BOOL)accessibilityIsIgnored;
337 // Returns the deepest descendant of the UIElement hierarchy that contains the point. You can assume the point has already been determined to lie within the receiver. Override this method to do deeper hit testing within a UIElement - e.g. a NSMatrix would test its cells. The point is bottom-left relative screen coordinates.
338 - (id)accessibilityHitTest:(NSPoint)point;
340 // Returns the UI Element that has the focus. You can assume that the search for the focus has already been narrowed down to the reciever. Override this method to do a deeper search with a UIElement - e.g. a NSMatrix would determine if one of its cells has the focus.
341 - (id)accessibilityFocusedUIElement;
346 @end
348 @interface SWELL_ModelessWindow : NSWindow
350 @public
351 NSSize lastFrameSize;
352 id m_owner;
353 OwnedWindowListRec *m_ownedwnds;
354 BOOL m_enabled;
355 int m_wantraiseamt;
356 bool m_wantInitialKeyWindowOnShow;
358 - (id)initModeless:(SWELL_DialogResourceIndex *)resstate Parent:(HWND)parent dlgProc:(DLGPROC)dlgproc Param:(LPARAM)par outputHwnd:(HWND *)hwndOut forceStyles:(unsigned int)smask;
359 - (id)initModelessForChild:(HWND)child owner:(HWND)owner styleMask:(unsigned int)smask;
360 - (void)swellDestroyAllOwnedWindows;
361 - (void)swellRemoveOwnedWindow:(NSWindow *)wnd;
362 - (void)swellSetOwner:(id)owner;
363 - (id)swellGetOwner;
364 - (void **)swellGetOwnerWindowHead;
365 -(void)swellDoDestroyStuff;
366 -(void)swellResetOwnedWindowLevels;
367 @end
369 @interface SWELL_ModalDialog : NSPanel
371 NSSize lastFrameSize;
372 id m_owner;
373 OwnedWindowListRec *m_ownedwnds;
375 int m_rv;
376 bool m_hasrv;
377 BOOL m_enabled;
379 - (id)initDialogBox:(SWELL_DialogResourceIndex *)resstate Parent:(HWND)parent dlgProc:(DLGPROC)dlgproc Param:(LPARAM)par;
380 - (void)swellDestroyAllOwnedWindows;
381 - (void)swellRemoveOwnedWindow:(NSWindow *)wnd;
382 - (void)swellSetOwner:(id)owner;
383 - (id)swellGetOwner;
384 - (void **)swellGetOwnerWindowHead;
385 -(void)swellDoDestroyStuff;
387 -(void)swellSetModalRetVal:(int)r;
388 -(int)swellGetModalRetVal;
389 -(bool)swellHasModalRetVal;
390 @end
393 @interface SWELL_hwndCarbonHost : SWELL_hwndChild
394 #ifdef MAC_OS_X_VERSION_10_7
395 <NSWindowDelegate>
396 #endif
398 @public
399 NSWindow *m_cwnd;
401 bool m_whileresizing;
402 void* m_wndhandler; // won't compile if declared EventHandlerRef, wtf
403 void* m_ctlhandler; // not sure if these need to be separate but cant hurt
404 bool m_wantallkeys;
406 -(BOOL)swellIsCarbonHostingView;
407 -(void)swellDoRepos;
408 @end
411 @interface SWELL_PopupMenuRecv : NSObject
413 int m_act;
414 HWND cbwnd;
416 -(id) initWithWnd:(HWND)wnd;
417 -(void) onSwellCommand:(id)sender;
418 -(int) isCommand;
419 - (void)menuNeedsUpdate:(NSMenu *)menu;
421 @end
423 @interface SWELL_PopUpButton : NSPopUpButton
425 LONG m_style;
427 -(void)setSwellStyle:(LONG)style;
428 -(LONG)getSwellStyle;
429 @end
431 @interface SWELL_ComboBox : NSComboBox
433 @public
434 LONG m_style;
435 WDL_PtrList<char> *m_ids;
437 -(id)init;
438 -(void)dealloc;
439 -(void)setSwellStyle:(LONG)style;
440 -(LONG)getSwellStyle;
441 @end
445 // GDI internals
447 #ifndef __AVAILABILITYMACROS__
448 #error __AVAILABILITYMACROS__ not defined, include AvailabilityMacros.h!
449 #endif
451 // 10.4 doesn't support CoreText, so allow ATSUI if targetting 10.4 SDK
452 #ifndef MAC_OS_X_VERSION_10_5
453 // 10.4 SDK
454 #define SWELL_NO_CORETEXT
455 #define SWELL_ATSUI_TEXT_SUPPORT
456 #else
458 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
459 #ifndef __LP64__
460 #define SWELL_ATSUI_TEXT_SUPPORT
461 #endif
462 #endif
464 #endif
466 struct HGDIOBJ__
468 int type;
470 int additional_refcnt; // refcnt of 0 means one owner (if >0, additional owners)
472 // used by pen/brush
473 CGColorRef color;
474 int wid;
475 NSImage *bitmapptr;
477 NSMutableDictionary *__old_fontdict; // unused, for ABI compat
479 // if ATSUI used, meaning IsCoreTextSupported() returned false
480 ATSUStyle atsui_font_style;
482 float font_rotation;
484 bool _infreelist;
485 struct HGDIOBJ__ *_next;
487 // if using CoreText to draw text
488 void *ct_FontRef;
489 char font_quality;
492 struct HDC__ {
493 CGContextRef ctx;
494 void *ownedData; // always use via SWELL_GetContextFrameBuffer() (which performs necessary alignment)
495 HGDIOBJ__ *curpen;
496 HGDIOBJ__ *curbrush;
497 HGDIOBJ__ *curfont;
499 NSColor *__old_nstextcol; // provided for ABI compat, but unused
500 int cur_text_color_int; // text color as int
502 int curbkcol;
503 int curbkmode;
504 float lastpos_x,lastpos_y;
506 void *GLgfxctx; // optionally set
507 bool _infreelist;
508 struct HDC__ *_next;
510 CGColorRef curtextcol; // text color as CGColor
517 // some extras so we can call functions available only on some OSX versions without warnings, and with the correct types
518 #define SWELL_DelegateExtensions __SWELL_PREFIX_CLASSNAME(_delext)
519 #define SWELL_ViewExtensions __SWELL_PREFIX_CLASSNAME(_viewext)
520 #define SWELL_AppExtensions __SWELL_PREFIX_CLASSNAME(_appext)
521 #define SWELL_WindowExtensions __SWELL_PREFIX_CLASSNAME(_wndext)
522 #define SWELL_TableColumnExtensions __SWELL_PREFIX_CLASSNAME(_tcolext)
524 @interface SWELL_WindowExtensions : NSWindow
525 -(void)setCollectionBehavior:(NSUInteger)a;
526 @end
527 @interface SWELL_ViewExtensions : NSView
528 -(void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)vr rectIsVisibleRectForView:(NSView*)v topView:(NSView *)v2;
529 @end
531 @interface SWELL_DelegateExtensions : NSObject
532 -(bool)swellPostMessage:(HWND)dest msg:(int)message wp:(WPARAM)wParam lp:(LPARAM)lParam;
533 -(void)swellPostMessageClearQ:(HWND)dest;
534 -(void)swellPostMessageTick:(id)sender;
535 @end
537 @interface SWELL_AppExtensions : NSApplication
538 -(NSUInteger)presentationOptions;
539 -(void)setPresentationOptions:(NSUInteger)o;
540 @end
541 @interface SWELL_TableColumnExtensions : NSTableColumn
542 -(BOOL)isHidden;
543 -(void)setHidden:(BOOL)h;
544 @end
550 #endif // __OBJC__
552 // 10.4 sdk just uses "float"
553 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
554 #ifdef __LP64__
555 typedef double CGFloat;
556 #else
557 typedef float CGFloat;
558 #endif
560 #endif
563 #elif defined(SWELL_TARGET_GDK)
565 #include <gdk/gdk.h>
566 #include <gdk/gdkkeysyms.h>
568 #else
569 // generic
571 #endif // end generic
573 #ifndef SWELL_TARGET_OSX
575 #ifdef SWELL_LICE_GDI
576 #include "../lice/lice.h"
577 #endif
578 #include "../assocarray.h"
580 LRESULT SwellDialogDefaultWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
582 struct HWND__
584 HWND__(HWND par, int wID=0, RECT *wndr=NULL, const char *label=NULL, bool visible=false, WNDPROC wndproc=NULL, DLGPROC dlgproc=NULL);
585 ~HWND__(); // DO NOT USE!!! We would make this private but it breaks PtrList using it on gcc.
587 // using this API prevents the HWND from being valid -- it'll still get its resources destroyed via DestroyWindow() though.
588 // DestroyWindow() does cleanup, then the final Release().
589 void Retain() { m_refcnt++; }
590 void Release() { if (!--m_refcnt) delete this; }
595 const char *m_classname;
598 #ifdef SWELL_TARGET_GDK
599 GdkWindow *m_oswindow;
600 #endif
601 char *m_title;
603 HWND__ *m_children, *m_parent, *m_next, *m_prev;
604 HWND__ *m_owner, *m_owned;
605 RECT m_position;
606 int m_id;
607 int m_style, m_exstyle;
608 INT_PTR m_userdata;
609 WNDPROC m_wndproc;
610 DLGPROC m_dlgproc;
611 INT_PTR m_extra[64];
612 INT_PTR m_private_data; // used by internal controls
614 bool m_visible;
615 bool m_hashaddestroy;
616 bool m_enabled;
617 bool m_wantfocus;
619 int m_refcnt;
621 HMENU m_menu;
623 WDL_StringKeyedArray<void *> m_props;
625 #ifdef SWELL_LICE_GDI
626 void *m_paintctx; // temporarily set for calls to WM_PAINT
628 // todo:
629 bool m_child_invalidated; // if a child is invalidated
630 bool m_invalidated; // set to true on direct invalidate. todo RECT instead?
632 LICE_IBitmap *m_backingstore; // if NULL, unused (probably only should use on top level windows, but support caching?)
633 #endif
636 struct HMENU__
638 HMENU__() { }
639 ~HMENU__() { items.Empty(true,freeMenuItem); }
641 WDL_PtrList<MENUITEMINFO> items;
643 HMENU__ *Duplicate();
644 static void freeMenuItem(void *p);
649 struct HGDIOBJ__
651 int type;
652 int additional_refcnt; // refcnt of 0 means one owner (if >0, additional owners)
654 int color;
655 int wid;
657 struct HGDIOBJ__ *_next;
658 bool _infreelist;
659 #ifdef SWELL_FREETYPE
660 void *fontface; // FT_Face
661 #endif
666 struct HDC__ {
667 #ifdef SWELL_LICE_GDI
668 LICE_IBitmap *surface; // owned by context. can be (and usually is, if clipping is desired) LICE_SubBitmap
669 POINT surface_offs; // offset drawing into surface by this amount
671 RECT dirty_rect; // in surface coordinates, used for GetWindowDC()/GetDC()/etc
672 bool dirty_rect_valid;
673 #else
674 void *ownedData; // for mem contexts, support a null rendering
675 #endif
677 HGDIOBJ__ *curpen;
678 HGDIOBJ__ *curbrush;
679 HGDIOBJ__ *curfont;
681 int cur_text_color_int; // text color as int
683 int curbkcol;
684 int curbkmode;
685 float lastpos_x,lastpos_y;
687 struct HDC__ *_next;
688 bool _infreelist;
691 #endif // !OSX
693 HDC SWELL_CreateGfxContext(void *);
695 // GDP internals
696 #define TYPE_PEN 1
697 #define TYPE_BRUSH 2
698 #define TYPE_FONT 3
699 #define TYPE_BITMAP 4
701 typedef struct
703 void *instptr;
704 void *bundleinstptr;
705 int refcnt;
707 int (*SWELL_dllMain)(HINSTANCE, DWORD,LPVOID); //last parm=SWELLAPI_GetFunc
708 BOOL (*dllMain)(HINSTANCE, DWORD, LPVOID);
709 void *lastSymbolRequested;
710 } SWELL_HINSTANCE;
713 enum
715 INTERNAL_OBJECT_START= 0x1000001,
716 INTERNAL_OBJECT_THREAD,
717 INTERNAL_OBJECT_EVENT,
718 INTERNAL_OBJECT_FILE,
719 INTERNAL_OBJECT_EXTERNALSOCKET, // socket not owned by us
720 INTERNAL_OBJECT_SOCKETEVENT,
721 INTERNAL_OBJECT_NSTASK,
722 INTERNAL_OBJECT_END
725 typedef struct
727 int type; // INTERNAL_OBJECT_*
728 int count; // reference count
729 } SWELL_InternalObjectHeader;
731 typedef struct
733 SWELL_InternalObjectHeader hdr;
734 DWORD (*threadProc)(LPVOID);
735 void *threadParm;
736 pthread_t pt;
737 DWORD retv;
738 bool done;
739 } SWELL_InternalObjectHeader_Thread;
741 typedef struct
743 SWELL_InternalObjectHeader hdr;
745 pthread_mutex_t mutex;
746 pthread_cond_t cond;
748 bool isSignal;
749 bool isManualReset;
751 } SWELL_InternalObjectHeader_Event;
754 // used for both INTERNAL_OBJECT_EXTERNALSOCKET and INTERNAL_OBJECT_SOCKETEVENT.
755 // if EXTERNALSOCKET, socket[1] ignored and autoReset ignored.
756 typedef struct
758 SWELL_InternalObjectHeader hdr;
759 int socket[2];
760 bool autoReset;
761 } SWELL_InternalObjectHeader_SocketEvent;
763 typedef struct
765 SWELL_InternalObjectHeader hdr;
767 FILE *fp;
768 } SWELL_InternalObjectHeader_File;
770 typedef struct
772 SWELL_InternalObjectHeader hdr;
773 void *task;
774 } SWELL_InternalObjectHeader_NSTask;
777 bool IsRightClickEmulateEnabled();
779 #endif