Newer
Older
/***********************************************************************
* FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
* Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For further information please contact the author by e-mail
* at "lyle@lylejohnson.name".
***********************************************************************/
%define DECLARE_FXAPP_VIRTUALS(klass)
%extend klass {
/// Create application's windows
virtual void create();
/// Destroy application's windows
virtual void destroy();
/// Detach application's windows
virtual void detach();
/**
* Run the main application event loop until stop() is called,
* and return the exit code passed as argument to stop().
*/
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/// Perform one event dispatch; return true if event was dispatched
bool runOneEvent(bool blocking=true);
/**
* Run an event loop till some flag becomes non-zero, and
* then return.
*/
FXint runUntil(FXuint& condition); // FIXME
/**
* Run event loop while events are available, non-modally.
* Return when no more events, timers, or chores are outstanding.
*/
FXint runWhileEvents();
/**
* Run event loop while there are events are available in the queue.
* Returns 1 when all events in the queue have been handled, and 0 when
* the event loop was terminated due to stop() or stopModal().
* Except for the modal window and its children, user input to all windows
* is blocked; if the modal window is NULL, all user input is blocked.
*/
FXint runModalWhileEvents(FXWindow* window=NULL);
/**
* Run modal event loop, blocking keyboard and mouse events to all windows
* until stopModal is called.
*/
FXint runModal();
/**
* Run a modal event loop for the given window, until stop() or stopModal() is
* called. Except for the modal window and its children, user input to all
* windows is blocked; if the modal window is NULL all user input is blocked.
*/
FXint runModalFor(FXWindow* window);
/**
* Run modal while window is shown, or until stop() or stopModal() is called.
* Except for the modal window and its children, user input to all windows
* is blocked; if the modal window is NULL all user input is blocked.
*/
FXint runModalWhileShown(FXWindow* window);
/**
* Run popup menu while shown, until stop() or stopModal() is called.
* Also returns when entering previous cascading popup menu.
*/
FXint runPopup(FXWindow* owner);
/**
* Initialize application.
* Parses and removes common command line arguments, reads the registry.
* Finally, if connect is TRUE, it opens the display.
*/
virtual void init(VALUE arr,bool connect=true);
/**
* Exit application.
* Closes the display and writes the registry.
*/
virtual void exit(FXint code=0);
}
%enddef
%define DECLARE_FXBITMAP_VIRTUALS(klass)
%extend klass {
/**
* Retrieves pixels from the server-side bitmap.
*/
virtual void restore();
/// Render pixels
virtual void render();
/// Release the client-side pixels buffer, freeing it if it was owned.
virtual void release();
/// Save pixel data only
virtual bool savePixels(FXStream& store) const;
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/// Load pixel data
virtual bool loadPixels(FXStream& store);
/// Rescale pixels to the specified width and height
virtual void scale(FXint w,FXint h);
/// Mirror bitmap horizontally and/or vertically
virtual void mirror(FXbool horizontal,FXbool vertical);
/// Rotate bitmap by degrees ccw
virtual void rotate(FXint degrees);
/// Crop bitmap to given rectangle
virtual void crop(FXint x,FXint y,FXint w,FXint h,FXbool color=0);
/// Fill bitmap with uniform value
virtual void fill(FXbool color);
/**
* Populate the bitmap with new pixel data of the same size; it will assume
* ownership of the pixel data if image BITMAP_OWNED option is passed.
* The server-side representation of the image, if it exists, is not updated.
* This can be done by calling render().
*/
virtual void setData(FXuchar *pix,FXuint opts=0);
/**
* Populate the bitmap with new pixel data of a new size; it will assume ownership
* of the pixel data if image BITMAP_OWNED option is passed. The size of the server-
* side representation of the image, if it exists, is adjusted but the contents are
* not updated yet. This can be done by calling render().
*/
virtual void setData(FXuchar *pix,FXuint opts,FXint w,FXint h);
}
%enddef
%define DECLARE_FXCURSOR_VIRTUALS(klass)
%extend klass {
/// Save pixel data only
virtual bool savePixels(FXStream& store) const;
/// Load pixel data
virtual bool loadPixels(FXStream& store);
}
%enddef
%define DECLARE_FXDC_VIRTUALS(klass)
%extend klass {
/// Read back pixel
virtual FXColor readPixel(FXint x,FXint y);
/// Draw points
virtual void drawPoint(FXint x,FXint y);
virtual void drawPoints(const FXPoint* points,FXuint npoints);
virtual void drawPointsRel(const FXPoint* points,FXuint npoints);
/// Draw lines
virtual void drawLine(FXint x1,FXint y1,FXint x2,FXint y2);
virtual void drawLines(const FXPoint* points,FXuint npoints);
virtual void drawLinesRel(const FXPoint* points,FXuint npoints);
virtual void drawLineSegments(const FXSegment* segments,FXuint nsegments);
/// Draw rectangles
virtual void drawRectangle(FXint x,FXint y,FXint w,FXint h);
virtual void drawRectangles(const FXRectangle* rectangles,FXuint nrectangles);
/// Draw rounded rectangle with ellipse with ew and ellips height eh
virtual void drawRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
/**
* Draw arcs.
* The argument ang1 specifies the start of the arc relative to the
* three-o'clock position from the center, in units of degrees*64.
* The argument ang2 specifies the path and extent of the arc relative
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
* to the start of the arc, in units of degrees*64.
* The arguments x,y,w,h specify the bounding rectangle.
*/
virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
virtual void drawArcs(const FXArc* arcs,FXuint narcs);
/// Draw ellipse
virtual void drawEllipse(FXint x,FXint y,FXint w,FXint h);
/// Filled rectangles
virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h);
virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles);
/// Draw filled rounded rectangle with ellipse with ew and ellips height eh
virtual void fillRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
/// Draw chords
virtual void fillChord(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
virtual void fillChords(const FXArc* chord,FXuint nchords);
/// Draw arcs
virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
virtual void fillArcs(const FXArc* arcs,FXuint narcs);
/// Filled polygon
virtual void fillPolygon(const FXPoint* points,FXuint npoints);
virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints);
virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints);
/// Filled polygon with relative points
virtual void fillPolygonRel(const FXPoint* points,FXuint npoints);
virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints);
virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints);
/// Draw hashed box
virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1);
/// Draw focus rectangle
virtual void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h);
/// Draw area from source
virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy);
/// Draw stretched area from source
virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy,FXint dw,FXint dh);
virtual void drawImage(const FXImage* image,FXint dx,FXint dy);
/// Draw bitmap
virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy);
virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy);
virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy);
virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy);
/// Draw string
// virtual void drawText(FXint x,FXint y,const FXString& string);
virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length);
// virtual void drawImageText(FXint x,FXint y,const FXString& string);
virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length);
/// Set foreground drawing color
virtual void setForeground(FXColor clr);
/// Set background drawing color
virtual void setBackground(FXColor clr);
/**
* Set dash pattern and dash offset.
* A dash pattern of [1 2 3 4] is a repeating pattern of 1 foreground pixel,
* 2 background pixels, 3 foreground pixels, and 4 background pixels.
* The offset is where in the pattern the system will start counting.
* The maximum length of the dash pattern is 32.
*/
virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength);
/// Set line width:- 0 means thinnest/fastest possible
virtual void setLineWidth(FXuint linewidth=0);
/// Set line cap style
virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT);
/// Set line join style
virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER);
/// Set line style
virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID);
/// Set fill style
virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID);
/// Set fill rule
virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD);
/// Set rasterop function
virtual void setFunction(FXFunction func=BLT_SRC);
/// Set the tile image
virtual void setTile(FXImage* image,FXint dx=0,FXint dy=0);
virtual void setStipple(FXBitmap *bitmap,FXint dx=0,FXint dy=0);
virtual void setStipple(FXStipplePattern pat,FXint dx=0,FXint dy=0);
/// Set clip region
virtual void setClipRegion(const FXRegion& region);
/// Set clip rectangle
virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h);
/// Change clip rectangle
virtual void setClipRectangle(const FXRectangle& rectangle);
/// Clear clipping
virtual void clearClipRectangle();
/// Set clip mask
virtual void setClipMask(FXBitmap* bitmap,FXint dx=0,FXint dy=0);
/// Clear clip mask
virtual void clearClipMask();
/// Set font to draw text with
virtual void setFont(FXFont *fnt);
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
/// Clip against child windows
virtual void clipChildren(FXbool yes);
}
%enddef
%define DECLARE_FXDIALOGBOX_VIRTUALS(klass)
%extend klass {
/// Run modal invocation of the dialog
virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR);
}
%enddef
%define DECLARE_FXDOCKBAR_VIRTUALS(klass)
%extend klass {
/**
* Dock the bar against the given side, after some other widget.
* However, if after is -1, it will be docked as the innermost bar just before
* the work-area, while if after is 0, if will be docked as the outermost bar.
*/
virtual void dock(FXDockSite* docksite,FXWindow* before=NULL,FXbool notify=FALSE);
/**
* Dock the bar against the given side, near the given position relative
* to the toolbar dock's origin.
*/
virtual void dock(FXDockSite* docksite,FXint localx,FXint localy,FXbool notify);
/**
* Undock or float the bar.
* The initial position of the wet dock is a few pixels
* below and to the right of the original docked position.
*/
virtual void undock(FXint rootx,FXint rooty,FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXDOCKSITE_VIRTUALS(klass)
%extend klass {
/**
* Move tool bar, changing its options to suite the new position.
* Used by the toolbar dragging to rearrange the toolbars inside the
* toolbar dock.
*/
virtual void moveToolBar(FXDockBar* bar,FXint barx,FXint bary);
/**
* The dock site is notified that the given bar has been added
* logically before the given window, and is to placed on a new
* galley all by itself. The default implementation adjusts
* the layout options of the bars accordingly.
*/
virtual void dockToolBar(FXDockBar* bar,FXWindow* before);
/**
* The dock site is informed that the given bar has been docked
* at the given coordinates. The default implementation determines
* where to insert the newly docked bar and adjusts the layout
* options of the bars accordingly.
*/
virtual void dockToolBar(FXDockBar* bar,FXint barx,FXint bary);
/**
* The dock site is informed that the given bar has been removed.
* In the default implementation, the dock site fixes the layout
* options of the remaining bars so they stay in the same place
* if possible.
*/
virtual void undockToolBar(FXDockBar* bar);
}
%enddef
%define DECLARE_FXDRAWABLE_VIRTUALS(klass)
%extend klass {
/// Resize drawable to the specified width and height
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
virtual void resize(FXint w,FXint h);
}
%enddef
%define DECLARE_FXFILEDICT_VIRTUALS(klass)
%extend klass {
virtual FXFileAssoc* findFileBinding(const FXchar* pathname);
virtual FXFileAssoc* findDirBinding(const FXchar* pathname);
virtual FXFileAssoc* findExecBinding(const FXchar* pathname);
}
%enddef
%define DECLARE_FXFOLDINGITEM_VIRTUALS(klass)
%extend klass {
virtual void setText(const FXString& txt);
virtual void setOpenIcon(FXIcon* icn,FXbool owned=FALSE);
virtual void setClosedIcon(FXIcon* icn,FXbool owned=FALSE);
virtual void setFocus(FXbool focus);
virtual void setSelected(FXbool selected);
virtual void setOpened(FXbool opened);
virtual void setExpanded(FXbool expanded);
virtual void setEnabled(FXbool enabled);
virtual void setDraggable(FXbool draggable);
virtual FXint getWidth(const FXFoldingList* list) const;
virtual FXint getHeight(const FXFoldingList* list) const;
virtual void create();
virtual void detach();
virtual void destroy();
}
%enddef
%define DECLARE_FXFOLDINGLIST_VIRTUALS(klass)
%extend klass {
virtual FXFoldingItem *getItemAt(FXint x,FXint y) const;
virtual void makeItemVisible(FXFoldingItem* item);
/// Enable item
virtual FXbool enableItem(FXFoldingItem* item);
/// Disable item
virtual FXbool disableItem(FXFoldingItem* item);
/// Select item
virtual FXbool selectItem(FXFoldingItem* item,FXbool notify=FALSE);
/// Deselect item
virtual FXbool deselectItem(FXFoldingItem* item,FXbool notify=FALSE);
/// Toggle item selection
virtual FXbool toggleItem(FXFoldingItem* item,FXbool notify=FALSE);
/// Extend selection from anchor item to item
virtual FXbool extendSelection(FXFoldingItem* item,FXbool notify=FALSE);
/// Deselect all items
virtual FXbool killSelection(FXbool notify=FALSE);
/// Open item
virtual FXbool openItem(FXFoldingItem* item,FXbool notify=FALSE);
/// Close item
virtual FXbool closeItem(FXFoldingItem* item,FXbool notify=FALSE);
/// Collapse tree
virtual FXbool collapseTree(FXFoldingItem* tree,FXbool notify=FALSE);
/// Expand tree
virtual FXbool expandTree(FXFoldingItem* tree,FXbool notify=FALSE);
/// Change current item
virtual void setCurrentItem(FXFoldingItem* item,FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXFONT_VIRTUALS(klass)
%extend klass {
/// Change font description
virtual void setFontDesc(const FXFontDesc& fontdesc);
/// Set to new angle, in degrees*64 relative to positive x axis
virtual void setAngle(FXint ang);
/**
* Change the font to the specified font description string.
*/
virtual void setFont(const FXString& string);
/// Find out if the font is monotype or proportional
virtual FXbool isFontMono() const;
%extend {
/// See if font has glyph for ch
virtual FXbool hasChar(VALUE ch) const {
if(TYPE(ch)==T_STRING){
if(RSTRING_LEN(ch)==1){
return self->hasChar(*(StringValuePtr(ch))); // FIXME: hasChar() expects an FXwchar
}
else{
rb_raise(rb_eArgError,"expected a string of length one");
}
}
else{
return self->hasChar(NUM2INT(ch)); // FIXME: hasChar() expects an FXwchar
}
}
}
/// Get first character glyph in font
/// Get last character glyph in font
virtual FXwchar getMaxChar() const;
/// Left bearing
virtual FXint leftBearing(FXwchar ch) const;
/// Right bearing
virtual FXint rightBearing(FXwchar ch) const;
/// Width of widest character in font
virtual FXint getFontWidth() const;
/// Height of highest character in font
virtual FXint getFontHeight() const;
/// Ascent from baseline
virtual FXint getFontAscent() const;
/// Descent from baseline
virtual FXint getFontDescent() const;
/// Get font leading [that is lead-ing as in Pb!]
virtual FXint getFontLeading() const;
/// Get font line spacing
virtual FXint getFontSpacing() const;
/// Calculate width of single wide character in this font
virtual FXint getCharWidth(const FXwchar ch) const;
/// Calculate width of given text in this font
virtual FXint getTextWidth(const FXString& string) const;
/// Calculate height of given text in this font
virtual FXint getTextHeight(const FXString& string) const;
}
%enddef
%define DECLARE_FXGLCANVAS_VIRTUALS(klass)
%extend klass {
/// Make OpenGL context current prior to performing OpenGL commands
virtual FXbool makeCurrent();
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
/// Make OpenGL context non current
virtual FXbool makeNonCurrent();
/// Return TRUE if context is current
virtual FXbool isCurrent() const;
/// Swap front and back buffer
virtual void swapBuffers();
}
%enddef
%define DECLARE_FXGLOBJECT_VIRTUALS(klass)
%extend klass {
/// Clone this object
virtual FXGLObject* copy();
/// Called by the viewer to get bounds for this object
virtual FXRangef bounds();
/// Draw this object in a viewer
virtual void draw(FXGLViewer* viewer);
/// Draw this object for hit-testing purposes
virtual void hit(FXGLViewer* viewer);
/// Return true if this object can be dragged around
virtual FXbool canDrag() const;
/// Return true if this object can be deleted from the scene
virtual FXbool canDelete() const;
/// Drag this object from one position to another
virtual FXbool drag(FXGLViewer* viewer,FXint fx,FXint fy,FXint tx,FXint ty);
}
%enddef
%define DECLARE_FXGLSHAPE_VIRTUALS(klass)
%extend klass {
virtual void drawshape(FXGLViewer*);
}
%enddef
%define DECLARE_FXGLVIEWER_VIRTUALS(klass)
%extend klass {
/// Return a NULL-terminated list of all objects in the given rectangle, or NULL
virtual FXGLObject** select(FXint x,FXint y,FXint w,FXint h);
/// Perform a pick operation, returning the object at the given x,y position, or NULL
virtual FXGLObject* pick(FXint x,FXint y);
/// Change the model bounding box; this adjusts the viewer
virtual FXbool setBounds(const FXRangef& box);
}
%enddef
%define DECLARE_FXHEADERITEM_VIRTUALS(klass)
%extend klass {
virtual void setText(const FXString& txt);
virtual void setIcon(FXIcon *ic);
virtual FXint getWidth(const FXHeader* header) const;
virtual FXint getHeight(const FXHeader* header) const;
virtual void create();
virtual void detach();
virtual void destroy();
}
%enddef
%define DECLARE_FXICONITEM_VIRTUALS(klass)
%extend klass {
virtual void draw(const FXIconList* list,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
virtual FXint hitItem(const FXIconList* list,FXint rx,FXint ry,FXint rw=1,FXint rh=1) const;
virtual void drawBigIcon(const FXIconList* list,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
virtual void drawMiniIcon(const FXIconList* list,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
virtual void drawDetails(const FXIconList* list,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
virtual void setText(const FXString& text);
virtual void setBigIcon(FXIcon* icn,FXbool owned=FALSE);
virtual void setMiniIcon(FXIcon* icn,FXbool owned=FALSE);
virtual void setFocus(FXbool focus);
virtual void setSelected(FXbool selected);
virtual void setEnabled(FXbool enabled);
virtual void setDraggable(FXbool draggable);
virtual FXint getWidth(const FXIconList* list) const;
virtual FXint getHeight(const FXIconList* list) const;
virtual void create();
virtual void detach();
virtual void destroy();
}
%enddef
%define DECLARE_FXICONLIST_VIRTUALS(klass)
%extend klass {
/// Select item at index
virtual FXbool selectItem(FXint index,FXbool notify=FALSE);
/// Deselect item at index
virtual FXbool deselectItem(FXint index,FXbool notify=FALSE);
/// Toggle item at index
virtual FXbool toggleItem(FXint index,FXbool notify=FALSE);
/// Select items in rectangle
virtual FXbool selectInRectangle(FXint x,FXint y,FXint w,FXint h,FXbool notify=FALSE);
/// Extend selection from anchor index to index
virtual FXbool extendSelection(FXint index,FXbool notify=FALSE);
/// Deselect all items
virtual FXbool killSelection(FXbool notify=FALSE);
/// Change current item index
virtual void setCurrentItem(FXint index,FXbool notify=FALSE);
/// Return index of item at x,y, or -1 if none
virtual FXint getItemAt(FXint x,FXint y) const;
/// Scroll to make item at index visible
virtual void makeItemVisible(FXint index);
/// Enable item at index
virtual FXbool enableItem(FXint index);
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
/// Disable item at index
virtual FXbool disableItem(FXint index);
}
%enddef
%define DECLARE_FXICONSOURCE_VIRTUALS(klass)
%extend klass {
/**
* Load an icon from the file filename. By default, the file extension is
* stripped and used as the icon type; if an explicit icon type is forced,
* then that type is used and the extension is ignored.
* For example, loadIcon("icon","gif") will try to load a CompuServe GIF
* file, since the filename does not give any clue as to the type of the
* icon.
*/
virtual FXIcon *loadIconFile(const FXString& filename,const FXString& type=FXString::null) const;
/**
* Load an icon of a given type (e.g. "gif") from reswrapped data.
* Returns NULL if there's some error loading the icon. [The optional
* parameter is actually mandatory at the time of this writing; future
* versions will attempt to inspect the first few bytes of the stream
* to divine the icon format if the parameter is omitted].
*/
virtual FXIcon *loadIconData(const void *pixels,const FXString& type=FXString::null) const;
/**
* Load an icon of a given type (e.g. "gif") from an already open stream.
* Returns NULL if there's some error loading the icon. [The optional
* parameter is actually mandatory at the time of this writing; future
* versions will attempt to inspect the first few bytes of the stream
* to divine the icon format if the parameter is omitted].
*/
virtual FXIcon *loadIconStream(FXStream& store,const FXString& type=FXString::null) const;
/**
* Load an image from the file filename. By default, the file extension is
* stripped and used as the image type; if an explicit image type is forced,
* then that type is used and the extension is ignored.
* For example, loadImage("image","gif") will try to load a CompuServe GIF
* file, since the filename does not give any clue as to the type of the
* image.
*/
virtual FXImage *loadImageFile(const FXString& filename,const FXString& type=FXString::null) const;
/**
* Load an image of a given type (e.g. "gif") from reswrapped data.
* Returns NULL if there's some error loading the icon. [The optional
* parameter is actually mandatory at the time of this writing; future
* versions will attempt to inspect the first few bytes of the stream
* to divine the icon format if the parameter is omitted].
*/
virtual FXImage *loadImageData(const void *pixels,const FXString& type=FXString::null) const;
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
/**
* Load an image of a given type (e.g. "gif") from an already open stream.
* Returns NULL if there's some error loading the image. [The optional
* parameter is actually mandatory at the time of this writing; future
* versions will attempt to inspect the first few bytes of the stream
* to divine the image format if the parameter is omitted].
*/
virtual FXImage *loadImageStream(FXStream& store,const FXString& type=FXString::null) const;
/// Load icon and scale it such that its dimensions does not exceed given size
virtual FXIcon *loadScaledIconFile(const FXString& filename,FXint size=32,FXint qual=0,const FXString& type=FXString::null) const;
/// Load icon and scale it such that its dimensions does not exceed given size
virtual FXIcon *loadScaledIconData(const void *pixels,FXint size=32,FXint qual=0,const FXString& type=FXString::null) const;
/// Load icon and scale it such that its dimensions does not exceed given size
virtual FXIcon *loadScaledIconStream(FXStream& store,FXint size=32,FXint qual=0,const FXString& type=FXString::null) const;
/// Load image and scale it such that its dimensions does not exceed given size
virtual FXImage *loadScaledImageFile(const FXString& filename,FXint size=32,FXint qual=0,const FXString& type=FXString::null) const;
/// Load image and scale it such that its dimensions does not exceed given size
virtual FXImage *loadScaledImageData(const void *pixels,FXint size=32,FXint qual=0,const FXString& type=FXString::null) const;
/// Load image and scale it such that its dimensions does not exceed given size
virtual FXImage *loadScaledImageStream(FXStream& store,FXint size=32,FXint qual=0,const FXString& type=FXString::null) const;
}
%enddef
%define DECLARE_FXID_VIRTUALS(klass)
%extend klass {
virtual void create();
virtual void detach();
virtual void destroy();
}
%enddef
%define DECLARE_FXIMAGE_VIRTUALS(klass)
%extend klass {
/**
* Retrieves pixels from the server-side image. For example, to make
* screen snapshots, or to retrieve an image after it has been drawn
* into by various means.
*/
virtual void restore();
/**
* Render the server-side representation of the image from client-side
* pixels. Normally, IMAGE_DITHER is used which causes the server-side
* representation to be rendered using a 16x16 ordered dither if necessary;
* however if IMAGE_NEAREST is used a faster (but uglier-looking), nearest
*/
virtual void render();
/**
* Release the client-side pixels buffer, free it if it was owned.
* If it is not owned, the image just forgets about the buffer.
*/
virtual void release();
* Rescale pixels image to the specified width and height; this calls
* resize() to adjust the client and server side representations.
*/
virtual void scale(FXint w,FXint h,FXint quality=0);
/// Mirror image horizontally and/or vertically
virtual void mirror(bool horizontal,bool vertical);
/**
* Rotate image by degrees ccw; this calls resize() to adjust the client
* and server side representations if necessary.
*/
virtual void rotate(FXint degrees);
/**
* Crop image to given rectangle; this calls resize() to adjust the client
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
* and server side representations.
*/
virtual void crop(FXint x,FXint y,FXint w,FXint h,FXColor color=0);
/// Fill image with uniform color
virtual void fill(FXColor color);
/// Fade image to uniform color
virtual void fade(FXColor color,FXint factor=255);
/**
* Shear image horizontally; the number of pixels is equal to the
* shear parameter times 256. The area outside the image is filled
* with transparent black, unless another color is specified.
*/
virtual void xshear(FXint shear,FXColor clr=0);
/**
* Shear image vertically; the number of pixels is equal to the
* shear parameter times 256. The area outside the image is filled
* with transparent black, unless another color is specified.
*/
virtual void yshear(FXint shear,FXColor clr=0);
/// Fill horizontal gradient
virtual void hgradient(FXColor left,FXColor right);
/// Fill vertical gradient
virtual void vgradient(FXColor top,FXColor bottom);
/// Fill with gradient
virtual void gradient(FXColor topleft,FXColor topright,FXColor bottomleft,FXColor bottomright);
/// Blend image over uniform color
virtual void blend(FXColor color);
virtual bool savePixels(FXStream& store) const;
virtual bool loadPixels(FXStream& store);
}
%enddef
%define DECLARE_FXLISTITEM_VIRTUALS(klass)
%extend klass {
virtual void setText(const FXString& txt);
virtual void setIcon(FXIcon* icn,FXbool owned=FALSE);
virtual void setFocus(FXbool focus);
virtual void setSelected(FXbool selected);
virtual void setEnabled(FXbool enabled);
virtual void setDraggable(FXbool draggable);
virtual FXint getWidth(const FXList* list) const;
virtual FXint getHeight(const FXList* list) const;
virtual void create();
virtual void detach();
virtual void destroy();
}
%enddef
%define DECLARE_FXLIST_VIRTUALS(klass)
%extend klass {
/// Enable item
virtual FXbool enableItem(FXint index);
/// Disable item
virtual FXbool disableItem(FXint index);
/// Scroll to bring item into view
virtual void makeItemVisible(FXint index);
/// Return index of item at x,y, if any
virtual FXint getItemAt(FXint x,FXint y) const;
/// Select item
virtual FXbool selectItem(FXint index,FXbool notify=FALSE);
/// Deselect item
virtual FXbool deselectItem(FXint index,FXbool notify=FALSE);
/// Toggle item selection state
virtual FXbool toggleItem(FXint index,FXbool notify=FALSE);
/// Extend selection from anchor item to index
virtual FXbool extendSelection(FXint index,FXbool notify=FALSE);
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// Deselect all items
virtual FXbool killSelection(FXbool notify=FALSE);
/// Change current item
virtual void setCurrentItem(FXint index,FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXLISTBOX_VIRTUALS(klass)
%extend klass {
/// Set the current item (index is zero-based)
virtual void setCurrentItem(FXint index,FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXMDICHILD_VIRTUALS(klass)
%extend klass {
virtual FXbool minimize(FXbool notify=FALSE);
virtual FXbool maximize(FXbool notify=FALSE);
virtual FXbool restore(FXbool notify=FALSE);
virtual FXbool close(FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXMDICLIENT_VIRTUALS(klass)
%extend klass {
/// Set active MDI Child
virtual FXbool setActiveChild(FXMDIChild* child=NULL,FXbool notify=TRUE);
// Cascade windows
virtual void cascade(FXbool notify=FALSE);
// Layout horizontally
virtual void horizontal(FXbool notify=FALSE);
// Layout vertically
virtual void vertical(FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXOBJECT_VIRTUALS(klass)
%extend klass {
/// Save object to stream
virtual void save(FXStream& store) const;
/// Load object from stream
virtual void load(FXStream& store);
}
%enddef
%define DECLARE_FXPOPUP_VIRTUALS(klass)
%extend klass {
virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0);
virtual void popdown();
}
%enddef
%define DECLARE_FXREALSPINNER_VIRTUALS(klass)
%extend klass {
virtual void setValue(FXdouble value,FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXSCROLLAREA_VIRTUALS(klass)
%extend klass {
virtual FXint getViewportHeight();
virtual FXint getViewportWidth();
virtual FXint getContentHeight();
virtual FXint getContentWidth();
/**
* Get the current position.
* Note: This is not a virtual member function in the C++ library,
* but we need to redeclare it here so that SWIG's overloading
* mechanism will correctly handle both this version and the the
* four-argument version of position() declared in class FXWindow.
*/
VALUE position() const {
FXint x, y;
self->getPosition(x, y);
VALUE pos = rb_ary_new();
rb_ary_push(pos, INT2NUM(x));
rb_ary_push(pos, INT2NUM(y));
return pos;
}
}
%enddef
%define DECLARE_FXSPINNER_VIRTUALS(klass)
%extend klass {
virtual void setValue(FXint value,FXbool notify=FALSE);
}
%enddef
%define DECLARE_FXSHUTTER_VIRTUALS(klass)
%extend klass {
virtual void setCurrent(FXint panel);
}
%enddef
%define DECLARE_FXSTREAM_VIRTUALS(klass)
%rename("setPosition") klass::position(FXlong offset,FXWhence whence);
%extend klass {
virtual bool close();
virtual bool flush();
virtual bool position(FXlong offset,FXWhence whence=FXFromStart);
}
%enddef
%define DECLARE_FXTABBAR_VIRTUALS(klass)
%extend klass {
virtual void setCurrent(FXint panel,FXbool notify=FALSE);
}
%enddef