TVision - Perl glue to the TurboVision library
SYNOPSIS
use TVision;
my $tapp = tnew 'TVApp';
my $w = tnew 'TWindow', [1,1,120,15], 'моё окно, товарищи',5;
my $b = tnew 'TButton', [1,1,30,3], 'кнопка', 125, 0;
my $checkboxes = tnew 'TCheckBoxes', [3,3,81,9], ['a'..'s'];
my $e = tnew TInputLine => ([3,11,81,13],100);
$tapp->deskTop->insert($w);
$w->insert($_) for ($checkboxes, $e, $b);
$e->focus();
$tapp->run;
DESCRIPTION
The TVision package is a perl glue to the TurboVision library github.com/magiblot/tvision.
TVision namespace contains subpakages of 2 types: * turbovision widgets (or 'controls') such as TButton, etc. * and also some helper packages, these are: ..........
All the TVision::xxxx widgets are array refs, where first item at index 0 holds address of the underlying C++ object, 2nd ($obj->[1]) generated widget name, 3rd - its path. 4rd item - left to user, any scalar could be stored there, please see the methods store_user_value/retrieve_user_value for this.
Some widgets (TButton) has 'num' key, which is usually small integer for the onCommand event. If 0 - then next availlable is taken.
TRect is array ref of 4 integers, which isn't always blessed to TVision::TRect. TPoint is array ref of 2 integers, which isn't always blessed to TVision::TPoint. TKey is array ref of 2 integers or just integer.
Following classes and members are mapped 1-1:
class TApplication : public virtual TSubsystemsInit, public TProgram
class TProgInit
class TProgram : public TGroup, public virtual TProgInit
class TBackground : public TView ...
class TButton : public TView
[x] TButton( const TRect& bounds, TStringView aTitle, ushort aCommand, ushort aFlags) noexcept;
class TCheckBoxes : public TCluster
class TCollection : public virtual TNSCollection, public TStreamable
class TNSCollection : public TObject
class TColorGroup
class TColorGroupList : public TListViewer
class TColorItem
class TColorIndex
class TColorItemList : public TListViewer
class TColorSelector : public TView
class TDeskTop : public TGroup, public virtual TDeskInit
class TEditWindow : public TWindow
class TEditor : public TView
class TMemo : public TEditor
class TFileEditor : public TEditor
class TInputLine : public TView
class TFrame : public TView
class TGroup : public TView
[x] void redraw() noexcept;
class THistory : public TView
class THistoryViewer : public TListViewer
class TIndicator : public TView
class TKey
class TLabel : public TStaticText
[x] TLabel( const TRect& bounds, TStringView aText, TView *aLink ) noexcept;
class TListBox : public TListViewer
class TListViewer : public TView
class TMenu
class TMenuBar : public TMenuView
class TMenuBox : public TMenuView
class TMenuItem
[x] TMenuItem( TStringView aName, ushort aCommand, TKey aKey, ushort aHelpCtx = hcNoContext, TStringView p = 0, TMenuItem *aNext = 0) noexcept;
[x] TMenuItem( TStringView aName, TKey aKey, TMenu *aSubMenu, ushort aHelpCtx = hcNoContext, TMenuItem *aNext = 0) noexcept;
[x] void append( TMenuItem *aNext ) noexcept;
[x] TMenuItem *next;
[x] ushort command;
[x] Boolean disabled;
[x] TKey keyCode;
[x] ushort helpCtx;
class TMenuPopup : public TMenuBox
class TMenuView : public Tiew
class TSubMenu : public TMenuItem
class TRadioButtons : public TCluster
class TRect TPoint a, b; ;
class TPoint int x,y; ;
class TKey
class TSItem
class TScrollBar : public TView
[x] TScrollBar( const TRect& bounds ) noexcept;
[x] void setParams( int aValue, int aMin, int aMax, int aPgStep, int aArStep ) noexcept;
[x] void setRange( int aMin, int aMax ) noexcept;
[x] void setStep( int aPgStep, int aArStep ) noexcept;
[x] void setValue( int aValue ) noexcept;
[x] void drawPos( int pos ) noexcept;
[x] int getPos() noexcept;
[x] int getSize() noexcept;
[x] int value;
[x] int minVal;
[x] int maxVal;
[x] int pgStep;
[x] int arStep;
class TScroller : public TView
[x] TScroller( const TRect& bounds, TScrollBar *aHScrollBar, TScrollBar *aVScrollBar) noexcept;
[x] void scrollTo( int x, int y ) noexcept;
[x] void setLimit( int x, int y ) noexcept;
[x] void checkDraw() noexcept;
[x] TPoint delta;
class TStaticText : public TView
[x] TStaticText( const TRect& bounds, TStringView aText ) noexcept;
class TStatusItem
class TStringView
class TView : public TObject, public TStreamable
[x] TView( const TRect& bounds ) noexcept;
[x] TRect getBounds() const noexcept;
[x] TRect getExtent() const noexcept;
[x] TRect getClipRect() const noexcept;
[x] Boolean mouseInView( TPoint mouse ) noexcept;
[x] void locate( TRect& bounds );
[x] void growTo( short x, short y );
[x] void moveTo( short x, short y );
[x] void hide();
[x] void show();
[x] void drawView() noexcept;
[x] Boolean exposed() noexcept;
[x] Boolean focus();
[x] void hideCursor();
[x] void drawHide( TView *lastView );
[x] void drawShow( TView *lastView );
[x] void drawUnderRect( TRect& r, TView *lastView );
[x] void drawUnderView( Boolean doShadow, TView *lastView );
[x] void blockCursor();
[x] void normalCursor();
[x] virtual void resetCursor();
[x] void setCursor( int x, int y ) noexcept;
[x] void showCursor();
[x] void drawCursor() noexcept;
[x] static Boolean commandEnabled( ushort command ) noexcept;
[x] static void disableCommand( ushort command ) noexcept;
[x] static void enableCommand( ushort command ) noexcept;
[x] virtual void endModal( ushort command );
[x] virtual ushort execute();
[x] Boolean getState( ushort aState ) const noexcept;
[x] void select();
[x] TPoint makeGlobal( TPoint source ) noexcept;
[x] TPoint makeLocal( TPoint source ) noexcept;
[x] TView *nextView() noexcept;
[x] TView *prevView() noexcept;
[x] TView *prev() noexcept;
[x] TView *next;
[x] void makeFirst();
[x] void putInFrontOf( TView *Target );
[x] TView *TopView() noexcept;
[x] TPoint size;
[x] ushort options;
[x] ushort eventMask;
[x] ushort state;
[x] TPoint origin;
[x] TPoint cursor;
[x] uchar growMode;
[x] uchar dragMode;
[x] ushort helpCtx;
[x] static Boolean _NEAR commandSetChanged;
[x] TGroup *owner;
[x] static Boolean _NEAR showMarkers;
[x] static uchar _NEAR errorAttr;
class TWindow: public TGroup, public virtual TWindowInit
[x] TWindow( const TRect& bounds, TStringView aTitle, short aNumber) noexcept;
[x] static TFrame *initFrame( TRect );
[x] TScrollBar *standardScrollBar( ushort aOptions ) noexcept;
[x] virtual void zoom();
[x] virtual void shutDown();
[x] uchar flags;
[x] TRect zoomRect;
[x] short number;
[x] short palette;
[x] TFrame *frame;
Getters and setters are named get_xxxx and set_xxxx respectively.
Functions
Most TVision functions are mapped into perl.
$str = TVision::messageBox($str, $options);
$str = TVision::messageBoxRect([$x0,$y0,$x1,$y1],$str, $options);
$str = TVision::inputBox($title, $label, $default="", $imit=1000);
$str = TVision::inputBoxRect([$x0,$y0,$x1,$y1],$title, $label, $default="", $imit=1000);
TVision::spin_loop();
TVision::TApplication::onCommand function
WIP
Geometry managers (not ready yet, pleae ignore this entire section)
Geometry manager tkpack stolen/hijacked from tcl/tk. In order for it to function properly, each widget gets its name ("path") TDesktop is '.', frame on it is .f, buttin on it could be named as .f.btn2, etc. Ideally widget's name is either specified by user, or generated on the fly at creation time. However we don't know who is widget's parent until it is "inserted" by the ...->insert method.
We hold widget's path in widget object, which is array ref, at item 2.
Mapping of widget names to correspoiding objects is held in %TVision::names, widget paths in %TVision::paths.