Update XPLM for ARM64
This commit is contained in:
@@ -1,79 +1,71 @@
|
||||
{
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
|
||||
All rights reserved. See license.txt for usage.
|
||||
|
||||
X-Plane SDK Version: 2.1.1
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
}
|
||||
|
||||
UNIT XPStandardWidgets;
|
||||
INTERFACE
|
||||
{
|
||||
XPStandardWidgets - THEORY OF OPERATION
|
||||
## THEORY OF OPERATION
|
||||
|
||||
The standard widgets are widgets built into the widgets library. While you
|
||||
can gain access to the widget function that drives them, you generally use
|
||||
them by calling XPCreateWidget and then listening for special messages,
|
||||
etc.
|
||||
The standard widgets are widgets built into the widgets library. While you
|
||||
can gain access to the widget function that drives them, you generally use
|
||||
them by calling XPCreateWidget and then listening for special messages,
|
||||
etc.
|
||||
|
||||
The standard widgets often send mesages to themselves when the user
|
||||
performs an event; these messages are sent up the widget hierarchy until
|
||||
they are handled. So you can add a widget proc directly to a push button
|
||||
(for example) to intercept the message when it is clicked, or you can put
|
||||
one widget proc on a window for all of the push buttons in the window.
|
||||
Most of these messages contain the original widget ID as a parameter so you
|
||||
can know which widget is messaging no matter who it is sent to.
|
||||
The standard widgets often send mesages to themselves when the user
|
||||
performs an event; these messages are sent up the widget hierarchy until
|
||||
they are handled. So you can add a widget proc directly to a push button
|
||||
(for example) to intercept the message when it is clicked, or you can put
|
||||
one widget proc on a window for all of the push buttons in the window. Most
|
||||
of these messages contain the original widget ID as a parameter so you can
|
||||
know which widget is messaging no matter who it is sent to.
|
||||
}
|
||||
|
||||
USES XPWidgetDefs;
|
||||
USES
|
||||
XPWidgetDefs;
|
||||
{$A4}
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$DEFINE DELPHI}
|
||||
{$ENDIF}
|
||||
{___________________________________________________________________________
|
||||
* MAIN WINDOW
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
The main window widget class provides a "window" as the user knows it.
|
||||
These windows are dragable and can be selected. Use them to create
|
||||
floating windows and non-modal dialogs.
|
||||
The main window widget class provides a "window" as the user knows it.
|
||||
These windows are dragable and can be selected. Use them to create floating
|
||||
windows and non-modal dialogs.
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_MainWindow = 1;
|
||||
|
||||
{
|
||||
Main Window Type Values
|
||||
|
||||
These type values are used to control the appearance of a main window.
|
||||
These type values are used to control the appearance of a main window.
|
||||
}
|
||||
{ The standard main window; pin stripes on XP7, metal frame on XP 6. }
|
||||
{ The standard main window; pin stripes on XP7, metal frame on XP 6. }
|
||||
xpMainWindowStyle_MainWindow = 0
|
||||
;
|
||||
{ A translucent dark gray window, like the one ATC messages appear in. }
|
||||
{ A translucent dark gray window, like the one ATC messages appear in. }
|
||||
xpMainWindowStyle_Translucent = 1
|
||||
;
|
||||
|
||||
{
|
||||
Main Window Properties
|
||||
|
||||
Main Window Properties
|
||||
}
|
||||
{ This property specifies the type of window. Set to one of the main window }
|
||||
{ types above. }
|
||||
{ This property specifies the type of window. Set to one of the main window }
|
||||
{ types above. }
|
||||
xpProperty_MainWindowType = 1100
|
||||
;
|
||||
{ This property specifies whether the main window has close boxes in its }
|
||||
{ corners. }
|
||||
{ This property specifies whether the main window has close boxes in its }
|
||||
{ corners. }
|
||||
xpProperty_MainWindowHasCloseBoxes = 1200
|
||||
;
|
||||
|
||||
{
|
||||
MainWindow Messages
|
||||
|
||||
MainWindow Messages
|
||||
}
|
||||
{ This message is sent when the close buttons are pressed for your window. }
|
||||
{ This message is sent when the close buttons are pressed for your window. }
|
||||
xpMessage_CloseButtonPushed = 1200
|
||||
;
|
||||
|
||||
@@ -81,37 +73,35 @@ CONST
|
||||
* SUB WINDOW
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
X-plane dialogs are divided into separate areas; the sub window widgets
|
||||
allow you to make these areas. Create one main window and place several
|
||||
subwindows inside it. Then place your controls inside the subwindows.
|
||||
X-Plane dialogs are divided into separate areas; the sub window widgets
|
||||
allow you to make these areas. Create one main window and place several
|
||||
subwindows inside it. Then place your controls inside the subwindows.
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_SubWindow = 2;
|
||||
|
||||
{
|
||||
SubWindow Type Values
|
||||
|
||||
These values control the appearance of the subwindow.
|
||||
These values control the appearance of the subwindow.
|
||||
}
|
||||
{ A panel that sits inside a main window. }
|
||||
{ A panel that sits inside a main window. }
|
||||
xpSubWindowStyle_SubWindow = 0
|
||||
;
|
||||
{ A screen that sits inside a panel for showing text information. }
|
||||
{ A screen that sits inside a panel for showing text information. }
|
||||
xpSubWindowStyle_Screen = 2
|
||||
;
|
||||
{ A list view for scrolling lists. }
|
||||
{ A list view for scrolling lists. }
|
||||
xpSubWindowStyle_ListView = 3
|
||||
;
|
||||
|
||||
{
|
||||
SubWindow Properties
|
||||
|
||||
SubWindow Properties
|
||||
}
|
||||
{ This property specifies the type of window. Set to one of the subwindow }
|
||||
{ types above. }
|
||||
{ This property specifies the type of window. Set to one of the subwindow }
|
||||
{ types above. }
|
||||
xpProperty_SubWindowType = 1200
|
||||
;
|
||||
|
||||
@@ -119,110 +109,108 @@ CONST
|
||||
* BUTTON
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
The button class provides a number of different button styles and
|
||||
behaviors, including push buttons, radio buttons, check boxes, etc. The
|
||||
button label appears on or next to the button depending on the button's
|
||||
appearance, or type.
|
||||
The button class provides a number of different button styles and
|
||||
behaviors, including push buttons, radio buttons, check boxes, etc. The
|
||||
button label appears on or next to the button depending on the button's
|
||||
appearance, or type.
|
||||
|
||||
The button's behavior is a separate property that dictates who it hilights
|
||||
and what kinds of messages it sends. Since behavior and type are
|
||||
different, you can do strange things like make check boxes that act as push
|
||||
buttons or push buttons with radio button behavior.
|
||||
The button's behavior is a separate property that dictates who it hilights
|
||||
and what kinds of messages it sends. Since behavior and type are different,
|
||||
you can do strange things like make check boxes that act as push buttons or
|
||||
push buttons with radio button behavior.
|
||||
|
||||
In X-Plane 6 there were no check box graphics. The result is the following
|
||||
behavior: in x-plane 6 all check box and radio buttons are round
|
||||
(radio-button style) buttons; in X-Plane 7 they are all square (check-box
|
||||
style) buttons. In a future version of x-plane, the xpButtonBehavior enums
|
||||
will provide the correct graphic (check box or radio button) giving the
|
||||
expected result.
|
||||
In X-Plane 6 there were no check box graphics. The result is the following
|
||||
behavior: in X-Plane
|
||||
6 all check box and radio buttons are round (radio-button style) buttons;
|
||||
in X-Plane 7 they are all square (check-box style) buttons. In a future
|
||||
version of X-Plane, the xpButtonBehavior enums will provide the correct
|
||||
graphic (check box or radio button) giving the expected result.
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_Button = 3;
|
||||
|
||||
{
|
||||
Button Types
|
||||
|
||||
These define the visual appearance of buttons but not how they respond to
|
||||
the mouse.
|
||||
These define the visual appearance of buttons but not how they respond to
|
||||
the mouse.
|
||||
}
|
||||
{ This is a standard push button, like an "OK" or "Cancel" button in a dialog }
|
||||
{ box. }
|
||||
{ This is a standard push button, like an 'OK' or 'Cancel' button in a dialog}
|
||||
{ box. }
|
||||
xpPushButton = 0
|
||||
;
|
||||
{ A check box or radio button. Use this and the button behaviors below to }
|
||||
{ get the desired behavior. }
|
||||
{ A check box or radio button. Use this and the button behaviors below to }
|
||||
{ get the desired behavior. }
|
||||
xpRadioButton = 1
|
||||
;
|
||||
{ A window close box. }
|
||||
{ A window close box. }
|
||||
xpWindowCloseBox = 3
|
||||
;
|
||||
{ A small down arrow. }
|
||||
{ A small down arrow. }
|
||||
xpLittleDownArrow = 5
|
||||
;
|
||||
{ A small up arrow. }
|
||||
{ A small up arrow. }
|
||||
xpLittleUpArrow = 6
|
||||
;
|
||||
|
||||
{
|
||||
Button Behavior Values
|
||||
|
||||
These define how the button responds to mouse clicks.
|
||||
These define how the button responds to mouse clicks.
|
||||
}
|
||||
{ Standard push button behavior. The button hilites while the mouse is }
|
||||
{ clicked over it and unhilites when the mouse is moved outside of it or }
|
||||
{ released. If the mouse is released over the button, the }
|
||||
{ xpMsg_PushButtonPressed message is sent. }
|
||||
{ Standard push button behavior. The button hilites while the mouse is }
|
||||
{ clicked over it and unhilites when the mouse is moved outside of it or }
|
||||
{ released. If the mouse is released over the button, the }
|
||||
{ xpMsg_PushButtonPressed message is sent. }
|
||||
xpButtonBehaviorPushButton = 0
|
||||
;
|
||||
{ Check box behavior. The button immediately toggles its value when the }
|
||||
{ mouse is clicked and sends out a xpMsg_ButtonStateChanged message. }
|
||||
{ Check box behavior. The button immediately toggles its value when the mouse}
|
||||
{ is clicked and sends out a xpMsg_ButtonStateChanged message. }
|
||||
xpButtonBehaviorCheckBox = 1
|
||||
;
|
||||
{ Radio button behavior. The button immediately sets its state to one and }
|
||||
{ sends out a xpMsg_ButtonStateChanged message if it was not already set to }
|
||||
{ one. You must turn off other radio buttons in a group in your code. }
|
||||
{ Radio button behavior. The button immediately sets its state to one and }
|
||||
{ sends out a xpMsg_ButtonStateChanged message if it was not already set to }
|
||||
{ one. You must turn off other radio buttons in a group in your code. }
|
||||
xpButtonBehaviorRadioButton = 2
|
||||
;
|
||||
|
||||
{
|
||||
Button Properties
|
||||
|
||||
Button Properties
|
||||
}
|
||||
{ This property sets the visual type of button. Use one of the button types }
|
||||
{ above. }
|
||||
{ This property sets the visual type of button. Use one of the button types }
|
||||
{ above. }
|
||||
xpProperty_ButtonType = 1300
|
||||
;
|
||||
{ This property sets the button's behavior. Use one of the button behaviors }
|
||||
{ above. }
|
||||
{ This property sets the button's behavior. Use one of the button behaviors }
|
||||
{ above. }
|
||||
xpProperty_ButtonBehavior = 1301
|
||||
;
|
||||
{ This property tells whether a check box or radio button is "checked" or }
|
||||
{ not. Not used for push buttons. }
|
||||
{ This property tells whether a check box or radio button is "checked" or }
|
||||
{ not. Not used for push buttons. }
|
||||
xpProperty_ButtonState = 1302
|
||||
;
|
||||
|
||||
{
|
||||
Button Messages
|
||||
|
||||
These messages are sent by the button to itself and then up the widget
|
||||
chain when the button is clicked. (You may intercept them by providing a
|
||||
widget handler for the button itself or by providing a handler in a parent
|
||||
widget.)
|
||||
These messages are sent by the button to itself and then up the widget
|
||||
chain when the button is clicked. (You may intercept them by providing a
|
||||
widget handler for the button itself or by providing a handler in a parent
|
||||
widget.)
|
||||
}
|
||||
{ This message is sent when the user completes a click and release in a }
|
||||
{ button with push button behavior. Parameter one of the message is the }
|
||||
{ widget ID of the button. This message is dispatched up the widget }
|
||||
{ hierarchy. }
|
||||
{ This message is sent when the user completes a click and release in a }
|
||||
{ button with push button behavior. Parameter one of the message is the }
|
||||
{ widget ID of the button. This message is dispatched up the widget }
|
||||
{ hierarchy. }
|
||||
xpMsg_PushButtonPressed = 1300
|
||||
;
|
||||
{ This message is sent when a button is clicked that has radio button or }
|
||||
{ check box behavior and its value changes. (Note that if the value changes }
|
||||
{ by setting a property you do not receive this message!) Parameter one is }
|
||||
{ the widget ID of the button, parameter 2 is the new state value, either }
|
||||
{ zero or one. This message is dispatched up the widget hierarchy. }
|
||||
{ This message is sent when a button is clicked that has radio button or }
|
||||
{ check box behavior and its value changes. (Note that if the value changes }
|
||||
{ by setting a property you do not receive this message!) Parameter one is }
|
||||
{ the widget ID of the button, parameter 2 is the new state value, either }
|
||||
{ zero or one. This message is dispatched up the widget hierarchy. }
|
||||
xpMsg_ButtonStateChanged = 1301
|
||||
;
|
||||
|
||||
@@ -230,91 +218,86 @@ CONST
|
||||
* TEXT FIELD
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
The text field widget provides an editable text field including mouse
|
||||
selection and keyboard navigation. The contents of the text field are its
|
||||
descriptor. (The descriptor changes as the user types.)
|
||||
The text field widget provides an editable text field including mouse
|
||||
selection and keyboard navigation. The contents of the text field are its
|
||||
descriptor. (The descriptor changes as the user types.)
|
||||
|
||||
The text field can have a number of types, that effect the visual layout of
|
||||
the text field. The text field sends messages to itself so you may control
|
||||
its behavior.
|
||||
The text field can have a number of types, that effect the visual layout of
|
||||
the text field. The text field sends messages to itself so you may control
|
||||
its behavior.
|
||||
|
||||
If you need to filter keystrokes, add a new handler and intercept the key
|
||||
press message. Since key presses are passed by pointer, you can modify the
|
||||
keystroke and pass it through to the text field widget.
|
||||
If you need to filter keystrokes, add a new handler and intercept the key
|
||||
press message. Since key presses are passed by pointer, you can modify the
|
||||
keystroke and pass it through to the text field widget.
|
||||
|
||||
WARNING: in x-plane before 7.10 (including 6.70) null characters could
|
||||
crash x-plane. To prevent this, wrap this object with a filter function
|
||||
(more instructions can be found on the SDK website).
|
||||
WARNING: in X-Plane before 7.10 (including 6.70) null characters could
|
||||
crash X-Plane. To prevent this, wrap this object with a filter function
|
||||
(more instructions can be found on the SDK website).
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_TextField = 4;
|
||||
|
||||
{
|
||||
Text Field Type Values
|
||||
|
||||
These control the look of the text field.
|
||||
These control the look of the text field.
|
||||
}
|
||||
{ A field for text entry. }
|
||||
{ A field for text entry. }
|
||||
xpTextEntryField = 0
|
||||
;
|
||||
{ A transparent text field. The user can type and the text is drawn, but no }
|
||||
{ background is drawn. You can draw your own background by adding a widget }
|
||||
{ handler and prehandling the draw message. }
|
||||
{ A transparent text field. The user can type and the text is drawn, but no }
|
||||
{ background is drawn. You can draw your own background by adding a widget }
|
||||
{ handler and prehandling the draw message. }
|
||||
xpTextTransparent = 3
|
||||
;
|
||||
{ A translucent edit field, dark gray. }
|
||||
{ A translucent edit field, dark gray. }
|
||||
xpTextTranslucent = 4
|
||||
;
|
||||
|
||||
{
|
||||
Text Field Properties
|
||||
|
||||
Text Field Properties
|
||||
}
|
||||
{ This is the character position the selection starts at, zero based. If it }
|
||||
{ is the same as the end insertion point, the insertion point is not a }
|
||||
{ selection. }
|
||||
{ This is the character position the selection starts at, zero based. If it }
|
||||
{ is the same as the end insertion point, the insertion point is not a }
|
||||
{ selection. }
|
||||
xpProperty_EditFieldSelStart = 1400
|
||||
;
|
||||
{ This is the character position of the end of the selection. }
|
||||
{ This is the character position of the end of the selection. }
|
||||
xpProperty_EditFieldSelEnd = 1401
|
||||
;
|
||||
{ This is the character position a drag was started at if the user is }
|
||||
{ dragging to select text, or -1 if a drag is not in progress. }
|
||||
{ This is the character position a drag was started at if the user is }
|
||||
{ dragging to select text, or -1 if a drag is not in progress. }
|
||||
xpProperty_EditFieldSelDragStart = 1402
|
||||
;
|
||||
{ This is the type of text field to display, from the above list. }
|
||||
{ This is the type of text field to display, from the above list. }
|
||||
xpProperty_TextFieldType = 1403
|
||||
;
|
||||
{ Set this property to 1 to password protect the field. Characters will be }
|
||||
{ drawn as *s even though the descriptor will contain plain-text. }
|
||||
{ Set this property to 1 to password protect the field. Characters will be }
|
||||
{ drawn as *s even though the descriptor will contain plain-text. }
|
||||
xpProperty_PasswordMode = 1404
|
||||
;
|
||||
{ The max number of characters you can enter, if limited. Zero means }
|
||||
{ unlimited. }
|
||||
{ The max number of characters you can enter, if limited. Zero means }
|
||||
{ unlimited. }
|
||||
xpProperty_MaxCharacters = 1405
|
||||
;
|
||||
{ The first visible character on the left. This effectively scrolls the text }
|
||||
{ field. }
|
||||
{ The first visible character on the left. This effectively scrolls the text}
|
||||
{ field. }
|
||||
xpProperty_ScrollPosition = 1406
|
||||
;
|
||||
{ The font to draw the field's text with. (An XPLMFontID.) }
|
||||
{ The font to draw the field's text with. (An XPLMFontID.) }
|
||||
xpProperty_Font = 1407
|
||||
;
|
||||
{ This is the active side of the insert selection. (Internal) }
|
||||
{ This is the active side of the insert selection. (Internal) }
|
||||
xpProperty_ActiveEditSide = 1408
|
||||
;
|
||||
|
||||
{
|
||||
Text Field Messages
|
||||
|
||||
Text Field Messages
|
||||
}
|
||||
{ Text Field Messages }
|
||||
{ }
|
||||
{ The text field sends this message to itself when its text changes. It }
|
||||
{ sends the message up the call chain; param1 is the text field's widget ID. }
|
||||
{ The text field sends this message to itself when its text changes. It sends}
|
||||
{ the message up the call chain; param1 is the text field's widget ID. }
|
||||
xpMsg_TextFieldChanged = 1400
|
||||
;
|
||||
|
||||
@@ -322,60 +305,55 @@ CONST
|
||||
* SCROLL BAR
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
A standard scroll bar or slider control. The scroll bar has a minimum,
|
||||
maximum and current value that is updated when the user drags it. The
|
||||
scroll bar sends continuous messages as it is dragged.
|
||||
A standard scroll bar or slider control. The scroll bar has a minimum,
|
||||
maximum and current value that is updated when the user drags it. The
|
||||
scroll bar sends continuous messages as it is dragged.
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_ScrollBar = 5;
|
||||
|
||||
{
|
||||
Scroll Bar Type Values
|
||||
|
||||
This defines how the scroll bar looks.
|
||||
This defines how the scroll bar looks.
|
||||
}
|
||||
{ Scroll bar types. }
|
||||
{ }
|
||||
{ A standard x-plane scroll bar (with arrows on the ends). }
|
||||
{ A standard X-Plane scroll bar (with arrows on the ends). }
|
||||
xpScrollBarTypeScrollBar = 0
|
||||
;
|
||||
{ A slider, no arrows. }
|
||||
{ A slider, no arrows. }
|
||||
xpScrollBarTypeSlider = 1
|
||||
;
|
||||
|
||||
{
|
||||
Scroll Bar Properties
|
||||
|
||||
Scroll Bar Properties
|
||||
}
|
||||
{ The current position of the thumb (in between the min and max, inclusive) }
|
||||
{ The current position of the thumb (in between the min and max, inclusive) }
|
||||
xpProperty_ScrollBarSliderPosition = 1500
|
||||
;
|
||||
{ The value the scroll bar has when the thumb is in the lowest position. }
|
||||
{ The value the scroll bar has when the thumb is in the lowest position. }
|
||||
xpProperty_ScrollBarMin = 1501
|
||||
;
|
||||
{ The value the scroll bar has when the thumb is in the highest position. }
|
||||
{ The value the scroll bar has when the thumb is in the highest position. }
|
||||
xpProperty_ScrollBarMax = 1502
|
||||
;
|
||||
{ How many units to moev the scroll bar when clicking next to the thumb. The }
|
||||
{ scroll bar always moves one unit when the arrows are clicked. }
|
||||
{ How many units to move the scroll bar when clicking next to the thumb. The }
|
||||
{ scroll bar always moves one unit when the arrows are clicked. }
|
||||
xpProperty_ScrollBarPageAmount = 1503
|
||||
;
|
||||
{ The type of scrollbar from the enums above. }
|
||||
{ The type of scrollbar from the enums above. }
|
||||
xpProperty_ScrollBarType = 1504
|
||||
;
|
||||
{ Used internally. }
|
||||
{ Used internally. }
|
||||
xpProperty_ScrollBarSlop = 1505
|
||||
;
|
||||
|
||||
{
|
||||
Scroll Bar Messages
|
||||
|
||||
Scroll Bar Messages
|
||||
}
|
||||
{ The Scroll Bar sends this message when the slider position changes. It }
|
||||
{ sends the message up the call chain; param1 is the Scroll Bar widget ID. }
|
||||
{ The scroll bar sends this message when the slider position changes. It }
|
||||
{ sends the message up the call chain; param1 is the Scroll Bar widget ID. }
|
||||
xpMsg_ScrollBarSliderPositionChanged = 1500
|
||||
;
|
||||
|
||||
@@ -383,22 +361,20 @@ CONST
|
||||
* CAPTION
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
A caption is a simple widget that shows its descriptor as a string, useful
|
||||
for labeling parts of a window. It always shows its descriptor as its
|
||||
string and is otherwise transparent.
|
||||
A caption is a simple widget that shows its descriptor as a string, useful
|
||||
for labeling parts of a window. It always shows its descriptor as its
|
||||
string and is otherwise transparent.
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_Caption = 6;
|
||||
|
||||
{
|
||||
Caption Properties
|
||||
|
||||
Caption Properties
|
||||
}
|
||||
{ This property specifies whether the caption is lit; use lit captions }
|
||||
{ against screens. }
|
||||
{ This property specifies whether the caption is lit; use lit captions }
|
||||
{ against screens. }
|
||||
xpProperty_CaptionLit = 1600
|
||||
;
|
||||
|
||||
@@ -406,19 +382,18 @@ CONST
|
||||
* GENERAL GRAPHICS
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
The general graphics widget can show one of many icons available from
|
||||
x-plane.
|
||||
The general graphics widget can show one of many icons available from
|
||||
X-Plane.
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_GeneralGraphics = 7;
|
||||
|
||||
{
|
||||
General Graphics Types Values
|
||||
|
||||
These define the icon for the general graphics.
|
||||
These define the icon for the general graphics.
|
||||
}
|
||||
xpShip = 4
|
||||
;
|
||||
@@ -460,10 +435,9 @@ CONST
|
||||
;
|
||||
|
||||
{
|
||||
General Graphics Properties
|
||||
|
||||
General Graphics Properties
|
||||
}
|
||||
{ This property controls the type of icon that is drawn. }
|
||||
{ This property controls the type of icon that is drawn. }
|
||||
xpProperty_GeneralGraphicsType = 1700
|
||||
;
|
||||
|
||||
@@ -471,27 +445,26 @@ CONST
|
||||
* PROGRESS INDICATOR
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
This widget implements a progress indicator as seen when x-plane starts up.
|
||||
This widget implements a progress indicator as seen when X-Plane starts up.
|
||||
}
|
||||
|
||||
|
||||
|
||||
CONST
|
||||
xpWidgetClass_Progress = 8;
|
||||
|
||||
{
|
||||
Progress Indicator Properties
|
||||
|
||||
Progress Indicator Properties
|
||||
}
|
||||
{ This is the current value of the progress indicator. }
|
||||
{ This is the current value of the progress indicator. }
|
||||
xpProperty_ProgressPosition = 1800
|
||||
;
|
||||
{ This is the minimum value, equivalent to 0% filled. }
|
||||
{ This is the minimum value, equivalent to 0% filled. }
|
||||
xpProperty_ProgressMin = 1801
|
||||
;
|
||||
{ This is the maximum value, equivalent to 100% filled. }
|
||||
{ This is the maximum value, equivalent to 100% filled. }
|
||||
xpProperty_ProgressMax = 1802
|
||||
;
|
||||
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
END.
|
||||
|
||||
@@ -1,66 +1,53 @@
|
||||
{
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
|
||||
All rights reserved. See license.txt for usage.
|
||||
|
||||
X-Plane SDK Version: 2.1.1
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
}
|
||||
|
||||
UNIT XPUIGraphics;
|
||||
INTERFACE
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
USES XPWidgetDefs;
|
||||
USES
|
||||
XPWidgetDefs;
|
||||
{$A4}
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$DEFINE DELPHI}
|
||||
{$ENDIF}
|
||||
{___________________________________________________________________________
|
||||
* UI GRAPHICS
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPWindowStyle
|
||||
|
||||
There are a few built-in window styles in X-Plane that you can use.
|
||||
There are a few built-in window styles in X-Plane that you can use.
|
||||
|
||||
Note that X-Plane 6 does not offer real shadow-compositing; you must make
|
||||
sure to put a window on top of another window of the right style to the
|
||||
shadows work, etc. This applies to elements with insets and shadows. The
|
||||
rules are:
|
||||
Note that X-Plane 6 does not offer real shadow-compositing; you must make
|
||||
sure to put a window on top of another window of the right style to the
|
||||
shadows work, etc. This applies to elements with insets and shadows. The
|
||||
rules are:
|
||||
|
||||
Sub windows must go on top of main windows, and screens and list views on
|
||||
top of subwindows. Only help and main windows can be over the main screen.
|
||||
Sub windows must go on top of main windows, and screens and list views on
|
||||
top of subwindows. Only help and main windows can be over the main screen.
|
||||
|
||||
With X-Plane 7 any window or element may be placed over any other element.
|
||||
|
||||
With X-Plane 7 any window or element may be placed over any other element.
|
||||
|
||||
Some windows are scaled by stretching, some by repeating. The drawing
|
||||
routines know which scaling method to use. The list view cannot be
|
||||
rescaled in x-plane 6 because it has both a repeating pattern and a
|
||||
gradient in one element. All other elements can be rescaled.
|
||||
Some windows are scaled by stretching, some by repeating. The drawing
|
||||
routines know which scaling method to use. The list view cannot be rescaled
|
||||
in X-Plane 6 because it has both a repeating pattern and a gradient in one
|
||||
element. All other elements can be rescaled.
|
||||
}
|
||||
TYPE
|
||||
XPWindowStyle = (
|
||||
{ An LCD screen that shows help. }
|
||||
{ An LCD screen that shows help. }
|
||||
xpWindow_Help = 0
|
||||
|
||||
{ A dialog box window. }
|
||||
{ A dialog box window. }
|
||||
,xpWindow_MainWindow = 1
|
||||
|
||||
{ A panel or frame within a dialog box window. }
|
||||
{ A panel or frame within a dialog box window. }
|
||||
,xpWindow_SubWindow = 2
|
||||
|
||||
{ An LCD screen within a panel to hold text displays. }
|
||||
{ An LCD screen within a panel to hold text displays. }
|
||||
,xpWindow_Screen = 4
|
||||
|
||||
{ A list view within a panel for scrolling file names, etc. }
|
||||
{ A list view within a panel for scrolling file names, etc. }
|
||||
,xpWindow_ListView = 5
|
||||
|
||||
);
|
||||
@@ -69,160 +56,152 @@ TYPE
|
||||
{
|
||||
XPDrawWindow
|
||||
|
||||
This routine draws a window of the given dimensions at the given offset on
|
||||
the virtual screen in a given style. The window is automatically scaled as
|
||||
appropriate using a bitmap scaling technique (scaling or repeating) as
|
||||
appropriate to the style.
|
||||
This routine draws a window of the given dimensions at the given offset on
|
||||
the virtual screen in a given style. The window is automatically scaled as
|
||||
appropriate using a bitmap scaling technique (scaling or repeating) as
|
||||
appropriate to the style.
|
||||
}
|
||||
PROCEDURE XPDrawWindow(
|
||||
inX1 : integer;
|
||||
inY1 : integer;
|
||||
inX2 : integer;
|
||||
inY2 : integer;
|
||||
inX1 : Integer;
|
||||
inY1 : Integer;
|
||||
inX2 : Integer;
|
||||
inY2 : Integer;
|
||||
inStyle : XPWindowStyle);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWindowDefaultDimensions
|
||||
|
||||
This routine returns the default dimensions for a window. Output is either
|
||||
a minimum or fixed value depending on whether the window is scalable.
|
||||
This routine returns the default dimensions for a window. Output is either
|
||||
a minimum or fixed value depending on whether the window is scalable.
|
||||
}
|
||||
PROCEDURE XPGetWindowDefaultDimensions(
|
||||
inStyle : XPWindowStyle;
|
||||
outWidth : Pinteger; { Can be nil }
|
||||
outHeight : Pinteger); { Can be nil }
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
outWidth : PInteger; { Can be nil }
|
||||
outHeight : PInteger); { Can be nil }
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPElementStyle
|
||||
|
||||
Elements are individually drawable UI things like push buttons, etc. The
|
||||
style defines what kind of element you are drawing. Elements can be
|
||||
stretched in one or two dimensions (depending on the element). Some
|
||||
elements can be lit.
|
||||
Elements are individually drawable UI things like push buttons, etc. The
|
||||
style defines what kind of element you are drawing. Elements can be
|
||||
stretched in one or two dimensions (depending on the element). Some
|
||||
elements can be lit.
|
||||
|
||||
In x-plane 6 some elements must be drawn over metal. Some are scalable and
|
||||
some are not. Any element can be drawn anywhere in x-plane 7.
|
||||
In X-Plane 6 some elements must be drawn over metal. Some are scalable and
|
||||
some are not. Any element can be drawn anywhere in X-Plane 7.
|
||||
|
||||
Scalable Axis Required Background
|
||||
Scalable Axis Required Background
|
||||
}
|
||||
TYPE
|
||||
XPElementStyle = (
|
||||
{ x metal }
|
||||
{ x metal }
|
||||
xpElement_TextField = 6
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_CheckBox = 9
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_CheckBoxLit = 10
|
||||
|
||||
{ none window header }
|
||||
{ none window header }
|
||||
,xpElement_WindowCloseBox = 14
|
||||
|
||||
{ none window header }
|
||||
{ none window header }
|
||||
,xpElement_WindowCloseBoxPressed = 15
|
||||
|
||||
{ x metal }
|
||||
{ x metal }
|
||||
,xpElement_PushButton = 16
|
||||
|
||||
{ x metal }
|
||||
{ x metal }
|
||||
,xpElement_PushButtonLit = 17
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_OilPlatform = 24
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_OilPlatformSmall = 25
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_Ship = 26
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_ILSGlideScope = 27
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_MarkerLeft = 28
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_Airport = 29
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_Waypoint = 30
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_NDB = 31
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_VOR = 32
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_RadioTower = 33
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_AircraftCarrier = 34
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_Fire = 35
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_MarkerRight = 36
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_CustomObject = 37
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_CoolingTower = 38
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_SmokeStack = 39
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_Building = 40
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_PowerLine = 41
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_CopyButtons = 45
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_CopyButtonsWithEditingGrid = 46
|
||||
|
||||
{ x, y metal }
|
||||
{ x, y metal }
|
||||
,xpElement_EditingGrid = 47
|
||||
|
||||
{ THIS CAN PROBABLY BE REMOVED }
|
||||
{ THIS CAN PROBABLY BE REMOVED }
|
||||
,xpElement_ScrollBar = 48
|
||||
|
||||
{ none any }
|
||||
{ none any }
|
||||
,xpElement_VORWithCompassRose = 49
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_Zoomer = 51
|
||||
|
||||
{ x, y metal }
|
||||
{ x, y metal }
|
||||
,xpElement_TextFieldMiddle = 52
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_LittleDownArrow = 53
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_LittleUpArrow = 54
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_WindowDragBar = 61
|
||||
|
||||
{ none metal }
|
||||
{ none metal }
|
||||
,xpElement_WindowDragBarSmooth = 62
|
||||
|
||||
);
|
||||
@@ -231,67 +210,60 @@ TYPE
|
||||
{
|
||||
XPDrawElement
|
||||
|
||||
XPDrawElement draws a given element at an offset on the virtual screen in
|
||||
set dimensions. EVEN if the element is not scalable, it will be scaled if
|
||||
the width and height do not match the preferred dimensions; it'll just look
|
||||
ugly. Pass inLit to see the lit version of the element; if the element
|
||||
cannot be lit this is ignored.
|
||||
XPDrawElement draws a given element at an offset on the virtual screen in
|
||||
set dimensions.
|
||||
*Even* if the element is not scalable, it will be scaled if the width and
|
||||
height do not match the preferred dimensions; it'll just look ugly. Pass
|
||||
inLit to see the lit version of the element; if the element cannot be lit
|
||||
this is ignored.
|
||||
}
|
||||
PROCEDURE XPDrawElement(
|
||||
inX1 : integer;
|
||||
inY1 : integer;
|
||||
inX2 : integer;
|
||||
inY2 : integer;
|
||||
inX1 : Integer;
|
||||
inY1 : Integer;
|
||||
inX2 : Integer;
|
||||
inY2 : Integer;
|
||||
inStyle : XPElementStyle;
|
||||
inLit : integer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inLit : Integer);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetElementDefaultDimensions
|
||||
|
||||
This routine returns the recommended or minimum dimensions of a given UI
|
||||
element. outCanBeLit tells whether the element has both a lit and unlit
|
||||
state. Pass NULL to not receive any of these parameters.
|
||||
This routine returns the recommended or minimum dimensions of a given UI
|
||||
element. outCanBeLit tells whether the element has both a lit and unlit
|
||||
state. Pass `NULL` to not receive any of these parameters.
|
||||
}
|
||||
PROCEDURE XPGetElementDefaultDimensions(
|
||||
inStyle : XPElementStyle;
|
||||
outWidth : Pinteger; { Can be nil }
|
||||
outHeight : Pinteger; { Can be nil }
|
||||
outCanBeLit : Pinteger); { Can be nil }
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
outWidth : PInteger; { Can be nil }
|
||||
outHeight : PInteger; { Can be nil }
|
||||
outCanBeLit : PInteger); { Can be nil }
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPTrackStyle
|
||||
|
||||
A track is a UI element that displays a value vertically or horizontally.
|
||||
X-Plane has three kinds of tracks: scroll bars, sliders, and progress bars.
|
||||
Tracks can be displayed either horizontally or vertically; tracks will
|
||||
choose their own layout based on the larger dimension of their dimensions
|
||||
(e.g. they know if they are tall or wide). Sliders may be lit or unlit
|
||||
(showing the user manipulating them).
|
||||
A track is a UI element that displays a value vertically or horizontally.
|
||||
X-Plane has three kinds of tracks: scroll bars, sliders, and progress bars.
|
||||
Tracks can be displayed either horizontally or vertically; tracks will
|
||||
choose their own layout based on the larger dimension of their dimensions
|
||||
(e.g. they know if they are tall or wide). Sliders may be lit or unlit
|
||||
(showing the user manipulating them).
|
||||
|
||||
ScrollBar - this is a standard scroll bar with arrows and a thumb to drag.
|
||||
Slider - this is a simple track with a ball in the middle that can be
|
||||
slid. Progress - this is a progress indicator showing how a long task is
|
||||
going.
|
||||
- ScrollBar: this is a standard scroll bar with arrows and a thumb to drag.
|
||||
- Slider: this is a simple track with a ball in the middle that can be
|
||||
slid.
|
||||
- Progress: this is a progress indicator showing how a long task is going.
|
||||
}
|
||||
TYPE
|
||||
XPTrackStyle = (
|
||||
{ not over metal can be lit can be rotated }
|
||||
{ not over metal can be lit can be rotated }
|
||||
xpTrack_ScrollBar = 0
|
||||
|
||||
{ over metal can be lit can be rotated }
|
||||
{ over metal can be lit can be rotated }
|
||||
,xpTrack_Slider = 1
|
||||
|
||||
{ over metal cannot be lit cannot be rotated }
|
||||
{ over metal cannot be lit cannot be rotated }
|
||||
,xpTrack_Progress = 2
|
||||
|
||||
);
|
||||
@@ -300,81 +272,71 @@ TYPE
|
||||
{
|
||||
XPDrawTrack
|
||||
|
||||
This routine draws a track. You pass in the track dimensions and size; the
|
||||
track picks the optimal orientation for these dimensions. Pass in the
|
||||
track's minimum current and maximum values; the indicator will be
|
||||
positioned appropriately. You can also specify whether the track is lit or
|
||||
not.
|
||||
This routine draws a track. You pass in the track dimensions and size; the
|
||||
track picks the optimal orientation for these dimensions. Pass in the
|
||||
track's minimum current and maximum values; the indicator will be
|
||||
positioned appropriately. You can also specify whether the track is lit or
|
||||
not.
|
||||
}
|
||||
PROCEDURE XPDrawTrack(
|
||||
inX1 : integer;
|
||||
inY1 : integer;
|
||||
inX2 : integer;
|
||||
inY2 : integer;
|
||||
inMin : integer;
|
||||
inMax : integer;
|
||||
inValue : integer;
|
||||
inX1 : Integer;
|
||||
inY1 : Integer;
|
||||
inX2 : Integer;
|
||||
inY2 : Integer;
|
||||
inMin : Integer;
|
||||
inMax : Integer;
|
||||
inValue : Integer;
|
||||
inTrackStyle : XPTrackStyle;
|
||||
inLit : integer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inLit : Integer);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetTrackDefaultDimensions
|
||||
|
||||
This routine returns a track's default smaller dimension; all tracks are
|
||||
scalable in the larger dimension. It also returns whether a track can be
|
||||
lit.
|
||||
This routine returns a track's default smaller dimension; all tracks are
|
||||
scalable in the larger dimension. It also returns whether a track can be
|
||||
lit.
|
||||
}
|
||||
PROCEDURE XPGetTrackDefaultDimensions(
|
||||
inStyle : XPTrackStyle;
|
||||
outWidth : Pinteger;
|
||||
outCanBeLit : Pinteger);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
outWidth : PInteger;
|
||||
outCanBeLit : PInteger);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetTrackMetrics
|
||||
|
||||
This routine returns the metrics of a track. If you want to write UI code
|
||||
to manipulate a track, this routine helps you know where the mouse
|
||||
locations are. For most other elements, the rectangle the element is drawn
|
||||
in is enough information. However, the scrollbar drawing routine does some
|
||||
automatic placement; this routine lets you know where things ended up. You
|
||||
pass almost everything you would pass to the draw routine. You get out the
|
||||
orientation, and other useful stuff.
|
||||
This routine returns the metrics of a track. If you want to write UI code
|
||||
to manipulate a track, this routine helps you know where the mouse
|
||||
locations are. For most other elements, the rectangle the element is drawn
|
||||
in is enough information. However, the scrollbar drawing routine does some
|
||||
automatic placement; this routine lets you know where things ended up. You
|
||||
pass almost everything you would pass to the draw routine. You get out the
|
||||
orientation, and other useful stuff.
|
||||
|
||||
Besides orientation, you get five dimensions for the five parts of a
|
||||
scrollbar, which are the down button, down area (area before the thumb),
|
||||
the thumb, and the up area and button. For horizontal scrollers, the left
|
||||
button decreases; for vertical scrollers, the top button decreases.
|
||||
Besides orientation, you get five dimensions for the five parts of a
|
||||
scrollbar, which are the down button, down area (area before the thumb),
|
||||
the thumb, and the up area and button. For horizontal scrollers, the left
|
||||
button decreases; for vertical scrollers, the top button decreases.
|
||||
}
|
||||
PROCEDURE XPGetTrackMetrics(
|
||||
inX1 : integer;
|
||||
inY1 : integer;
|
||||
inX2 : integer;
|
||||
inY2 : integer;
|
||||
inMin : integer;
|
||||
inMax : integer;
|
||||
inValue : integer;
|
||||
inX1 : Integer;
|
||||
inY1 : Integer;
|
||||
inX2 : Integer;
|
||||
inY2 : Integer;
|
||||
inMin : Integer;
|
||||
inMax : Integer;
|
||||
inValue : Integer;
|
||||
inTrackStyle : XPTrackStyle;
|
||||
outIsVertical : Pinteger;
|
||||
outDownBtnSize : Pinteger;
|
||||
outDownPageSize : Pinteger;
|
||||
outThumbSize : Pinteger;
|
||||
outUpPageSize : Pinteger;
|
||||
outUpBtnSize : Pinteger);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
outIsVertical : PInteger;
|
||||
outDownBtnSize : PInteger;
|
||||
outDownPageSize : PInteger;
|
||||
outThumbSize : PInteger;
|
||||
outUpPageSize : PInteger;
|
||||
outUpBtnSize : PInteger);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
END.
|
||||
|
||||
@@ -1,43 +1,34 @@
|
||||
{
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
|
||||
All rights reserved. See license.txt for usage.
|
||||
|
||||
X-Plane SDK Version: 2.1.1
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
}
|
||||
|
||||
UNIT XPWidgetDefs;
|
||||
INTERFACE
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
USES XPLMDefs;
|
||||
USES
|
||||
XPLMDefs;
|
||||
{$A4}
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$DEFINE DELPHI}
|
||||
{$ENDIF}
|
||||
{___________________________________________________________________________
|
||||
* WIDGET DEFINITIONS
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
A widget is a call-back driven screen entity like a push-button, window,
|
||||
text entry field, etc.
|
||||
A widget is a call-back driven screen entity like a push-button, window,
|
||||
text entry field, etc.
|
||||
|
||||
Use the widget API to create widgets of various classes. You can nest them
|
||||
into trees of widgets to create complex user interfaces.
|
||||
Use the widget API to create widgets of various classes. You can nest them
|
||||
into trees of widgets to create complex user interfaces.
|
||||
}
|
||||
|
||||
|
||||
|
||||
TYPE
|
||||
{
|
||||
XPWidgetID
|
||||
|
||||
A Widget ID is an opaque unique non-zero handle identifying your widget.
|
||||
Use 0 to specify "no widget". This type is defined as wide enough to hold
|
||||
a pointer. You receive a widget ID when you create a new widget and then
|
||||
use that widget ID to further refer to the widget.
|
||||
A Widget ID is an opaque unique non-zero handle identifying your widget.
|
||||
Use 0 to specify "no widget". This type is defined as wide enough to hold a
|
||||
pointer. You receive a widget ID when you create a new widget and then use
|
||||
that widget ID to further refer to the widget.
|
||||
}
|
||||
XPWidgetID = pointer;
|
||||
PXPWidgetID = ^XPWidgetID;
|
||||
@@ -45,46 +36,48 @@ TYPE
|
||||
{
|
||||
XPWidgetPropertyID
|
||||
|
||||
Properties are values attached to instances of your widgets. A property is
|
||||
identified by a 32-bit ID and its value is the width of a pointer.
|
||||
Properties are values attached to instances of your widgets. A property is
|
||||
identified by a 32-bit ID and its value is the width of a pointer.
|
||||
|
||||
Each widget instance may have a property or not have it. When you set a
|
||||
property on a widget for the first time, the property is added to the
|
||||
widget; it then stays there for the life of the widget.
|
||||
Each widget instance may have a property or not have it. When you set a
|
||||
property on a widget for the first time, the property is added to the
|
||||
widget; it then stays there for the life of the widget.
|
||||
|
||||
Some property IDs are predefined by the widget package; you can make up
|
||||
your own property IDs as well.
|
||||
Some property IDs are predefined by the widget package; you can make up
|
||||
your own property IDs as well.
|
||||
}
|
||||
XPWidgetPropertyID = (
|
||||
{ A window's refcon is an opaque value used by client code to find other data }
|
||||
{ based on it. }
|
||||
{ A window's refcon is an opaque value used by client code to find other data}
|
||||
{ based on it. }
|
||||
xpProperty_Refcon = 0
|
||||
|
||||
{ These properties are used by the utlities to implement dragging. }
|
||||
{ These properties are used by the utlities to implement dragging. }
|
||||
,xpProperty_Dragging = 1
|
||||
|
||||
,xpProperty_DragXOff = 2
|
||||
|
||||
,xpProperty_DragYOff = 3
|
||||
|
||||
{ Is the widget hilited? (For widgets that support this kind of thing.) }
|
||||
{ Is the widget hilited? (For widgets that support this kind of thing.) }
|
||||
,xpProperty_Hilited = 4
|
||||
|
||||
{ Is there a C++ object attached to this widget? }
|
||||
{ Is there a C++ object attached to this widget? }
|
||||
,xpProperty_Object = 5
|
||||
|
||||
{ If this property is 1, the widget package will use OpenGL to restrict }
|
||||
{ drawing to the Wiget's exposed rectangle. }
|
||||
{ If this property is 1, the widget package will use OpenGL to restrict }
|
||||
{ drawing to the Wiget's exposed rectangle. }
|
||||
,xpProperty_Clip = 6
|
||||
|
||||
{ Is this widget enabled (for those that have a disabled state too)? }
|
||||
{ Is this widget enabled (for those that have a disabled state too)? }
|
||||
,xpProperty_Enabled = 7
|
||||
|
||||
{ NOTE: Property IDs 1 - 999 are reserved for the widget's library. }
|
||||
{ }
|
||||
{ NOTE: Property IDs 1000 - 9999 are allocated to the standard widget classes }
|
||||
{ provided with the library Properties 1000 - 1099 are for widget class 0, }
|
||||
{ 1100 - 1199 for widget class 1, etc. }
|
||||
{ NOTE: Property IDs 1 - 999 are reserved for the widgets library. }
|
||||
{ }
|
||||
{ NOTE: Property IDs 1000 - 9999 are allocated to the standard widget classes}
|
||||
{ provided with the library. }
|
||||
{ }
|
||||
{ Properties 1000 - 1099 are for widget class 0, 1100 - 1199 for widget class}
|
||||
{ 1, etc. }
|
||||
,xpProperty_UserStart = 10000
|
||||
|
||||
);
|
||||
@@ -93,78 +86,78 @@ TYPE
|
||||
{
|
||||
XPMouseState_t
|
||||
|
||||
When the mouse is clicked or dragged, a pointer to this structure is passed
|
||||
to your widget function.
|
||||
When the mouse is clicked or dragged, a pointer to this structure is passed
|
||||
to your widget function.
|
||||
}
|
||||
XPMouseState_t = RECORD
|
||||
x : integer;
|
||||
y : integer;
|
||||
{ Mouse Button number, left = 0 (right button not yet supported. }
|
||||
button : integer;
|
||||
x : Integer;
|
||||
y : Integer;
|
||||
{ Mouse Button number, left = 0 (right button not yet supported. }
|
||||
button : Integer;
|
||||
{$IFDEF XPLM200}
|
||||
{ Scroll wheel delta (button in this case would be the wheel axis number). }
|
||||
delta : integer;
|
||||
{$ENDIF}
|
||||
{ Scroll wheel delta (button in this case would be the wheel axis number). }
|
||||
delta : Integer;
|
||||
{$ENDIF XPLM200}
|
||||
END;
|
||||
PXPMouseState_t = ^XPMouseState_t;
|
||||
|
||||
{
|
||||
XPKeyState_t
|
||||
|
||||
When a key is pressed, a pointer to this struct is passed to your widget
|
||||
function.
|
||||
When a key is pressed, a pointer to this struct is passed to your widget
|
||||
function.
|
||||
}
|
||||
XPKeyState_t = RECORD
|
||||
{ The ASCII key that was pressed. WARNING: this may be 0 for some non-ASCII }
|
||||
{ key sequences. }
|
||||
key : char;
|
||||
{ The flags. Make sure to check this if you only want key-downs! }
|
||||
{ The ASCII key that was pressed. WARNING: this may be 0 for some non-ASCII }
|
||||
{ key sequences. }
|
||||
key : XPLMChar;
|
||||
{ The flags. Make sure to check this if you only want key-downs! }
|
||||
flags : XPLMKeyFlags;
|
||||
{ The virtual key code for the key }
|
||||
vkey : char;
|
||||
{ The virtual key code for the key }
|
||||
vkey : XPLMChar;
|
||||
END;
|
||||
PXPKeyState_t = ^XPKeyState_t;
|
||||
|
||||
{
|
||||
XPWidgetGeometryChange_t
|
||||
|
||||
This structure contains the deltas for your widget's geometry when it
|
||||
changes.
|
||||
This structure contains the deltas for your widget's geometry when it
|
||||
changes.
|
||||
}
|
||||
XPWidgetGeometryChange_t = RECORD
|
||||
dx : integer;
|
||||
{ +Y = the widget moved up }
|
||||
dy : integer;
|
||||
dwidth : integer;
|
||||
dheight : integer;
|
||||
dx : Integer;
|
||||
{ +Y = the widget moved up }
|
||||
dy : Integer;
|
||||
dwidth : Integer;
|
||||
dheight : Integer;
|
||||
END;
|
||||
PXPWidgetGeometryChange_t = ^XPWidgetGeometryChange_t;
|
||||
|
||||
{
|
||||
XPDispatchMode
|
||||
|
||||
The dispatching modes describe how the widgets library sends out messages.
|
||||
Currently there are three modes:
|
||||
The dispatching modes describe how the widgets library sends out messages.
|
||||
Currently there are three modes:
|
||||
}
|
||||
XPDispatchMode = (
|
||||
{ The message will only be sent to the target widget. }
|
||||
{ The message will only be sent to the target widget. }
|
||||
xpMode_Direct = 0
|
||||
|
||||
{ The message is sent to the target widget, then up the chain of parents }
|
||||
{ until the message is handled or a parentless widget is reached. }
|
||||
{ The message is sent to the target widget, then up the chain of parents }
|
||||
{ until the message is handled or a parentless widget is reached. }
|
||||
,xpMode_UpChain = 1
|
||||
|
||||
{ The message is sent to the target widget and then all of its children }
|
||||
{ recursively depth-first. }
|
||||
{ The message is sent to the target widget and then all of its children }
|
||||
{ recursively depth-first. }
|
||||
,xpMode_Recursive = 2
|
||||
|
||||
{ The message is snet just to the target, but goes to every callback, even if }
|
||||
{ it is handled. }
|
||||
{ The message is snet just to the target, but goes to every callback, even if}
|
||||
{ it is handled. }
|
||||
,xpMode_DirectAllCallbacks = 3
|
||||
|
||||
{ The message is only sent to the very first handler even if it is not }
|
||||
{ accepted. (This is really only useful for some internal Widget Lib }
|
||||
{ functions. }
|
||||
{ The message is only sent to the very first handler even if it is not }
|
||||
{ accepted. (This is really only useful for some internal widget library }
|
||||
{ functions.) }
|
||||
,xpMode_Once = 4
|
||||
|
||||
);
|
||||
@@ -173,240 +166,235 @@ TYPE
|
||||
{
|
||||
XPWidgetClass
|
||||
|
||||
Widget classes define predefined widget types. A widget class basically
|
||||
specifies from a library the widget function to be used for the widget.
|
||||
Most widgets can be made right from classes.
|
||||
Widget classes define predefined widget types. A widget class basically
|
||||
specifies from a library the widget function to be used for the widget.
|
||||
Most widgets can be made right from classes.
|
||||
}
|
||||
XPWidgetClass = integer;
|
||||
XPWidgetClass = Integer;
|
||||
PXPWidgetClass = ^XPWidgetClass;
|
||||
|
||||
CONST
|
||||
{ An unspecified widget class. Other widget classes are in }
|
||||
{ XPStandardWidgets.h }
|
||||
{ An unspecified widget class. Other widget classes are in }
|
||||
{ XPStandardWidgets.h }
|
||||
xpWidgetClass_None = 0;
|
||||
|
||||
{___________________________________________________________________________
|
||||
* WIDGET MESSAGES
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPWidgetMessage
|
||||
|
||||
Widgets receive 32-bit messages indicating what action is to be taken or
|
||||
notifications of events. The list of messages may be expanded.
|
||||
Widgets receive 32-bit messages indicating what action is to be taken or
|
||||
notifications of events. The list of messages may be expanded.
|
||||
}
|
||||
TYPE
|
||||
XPWidgetMessage = (
|
||||
{ No message, should not be sent. }
|
||||
{ No message, should not be sent. }
|
||||
xpMsg_None = 0
|
||||
|
||||
{ The create message is sent once per widget that is created with your widget }
|
||||
{ function and once for any widget that has your widget function attached. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: 1 if you are being added as a subclass, 0 if the widget is first }
|
||||
{ being created. }
|
||||
{ The create message is sent once per widget that is created with your widget}
|
||||
{ function and once for any widget that has your widget function attached. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: 1 if you are being added as a subclass, 0 if the widget is first }
|
||||
{ being created. }
|
||||
,xpMsg_Create = 1
|
||||
|
||||
{ The destroy message is sent once for each message that is destroyed that }
|
||||
{ has your widget function. }
|
||||
{ }
|
||||
{ Dispatching: Direct for all }
|
||||
{ }
|
||||
{ Param 1: 1 if being deleted by a recursive delete to the parent, 0 for }
|
||||
{ explicit deletion. }
|
||||
{ The destroy message is sent once for each message that is destroyed that }
|
||||
{ has your widget function. }
|
||||
{ }
|
||||
{ Dispatching: Direct for all }
|
||||
{ }
|
||||
{ Param 1: 1 if being deleted by a recursive delete to the parent, 0 for }
|
||||
{ explicit deletion. }
|
||||
,xpMsg_Destroy = 2
|
||||
|
||||
{ The paint message is sent to your widget to draw itself. The paint message }
|
||||
{ is the bare-bones message; in response you must draw yourself, draw your }
|
||||
{ children, set up clipping and culling, check for visibility, etc. If you }
|
||||
{ don't want to do all of this, ignore the paint message and a draw message }
|
||||
{ (see below) will be sent to you. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ The paint message is sent to your widget to draw itself. The paint message }
|
||||
{ is the bare-bones message; in response you must draw yourself, draw your }
|
||||
{ children, set up clipping and culling, check for visibility, etc. If you }
|
||||
{ don't want to do all of this, ignore the paint message and a draw message }
|
||||
{ (see below) will be sent to you. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
,xpMsg_Paint = 3
|
||||
|
||||
{ The draw message is sent to your widget when it is time to draw yourself. }
|
||||
{ OpenGL will be set up to draw in 2-d global screen coordinates, but you }
|
||||
{ should use the XPLM to set up OpenGL state. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ The draw message is sent to your widget when it is time to draw yourself. }
|
||||
{ OpenGL will be set up to draw in 2-d global screen coordinates, but you }
|
||||
{ should use the XPLM to set up OpenGL state. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
,xpMsg_Draw = 4
|
||||
|
||||
{ The key press message is sent once per key that is pressed. The first }
|
||||
{ parameter is the type of key code (integer or char) and the second is the }
|
||||
{ code itself. By handling this event, you consume the key stroke. }
|
||||
{ }
|
||||
{ Handling this message 'consumes' the keystroke; not handling it passes it }
|
||||
{ to your parent widget. }
|
||||
{ }
|
||||
{ Dispatching: Up Chain }
|
||||
{ }
|
||||
{ : Param 1: A pointer to an XPKeyState_t structure with the keystroke. }
|
||||
{ The key press message is sent once per key that is pressed. The first }
|
||||
{ parameter is the type of key code (integer or char) and the second is the }
|
||||
{ code itself. By handling this event, you consume the key stroke. }
|
||||
{ }
|
||||
{ Handling this message 'consumes' the keystroke; not handling it passes it }
|
||||
{ to your parent widget. }
|
||||
{ }
|
||||
{ Dispatching: Up Chain }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPKeyState_t structure with the keystroke. }
|
||||
,xpMsg_KeyPress = 5
|
||||
|
||||
{ Keyboard focus is being given to you. By handling this message you accept }
|
||||
{ keyboard focus. The first parameter will be one if a child of yours gave }
|
||||
{ up focus to you, 0 if someone set focus on you explicitly. }
|
||||
{ }
|
||||
{ : Handling this message accepts focus; not handling refuses focus. }
|
||||
{ }
|
||||
{ Dispatching: direct }
|
||||
{ }
|
||||
{ Param 1: 1 if you are gaining focus because your child is giving it up, 0 }
|
||||
{ if someone is explicitly giving you focus. }
|
||||
{ Keyboard focus is being given to you. By handling this message you accept }
|
||||
{ keyboard focus. The first parameter will be one if a child of yours gave up}
|
||||
{ focus to you, 0 if someone set focus on you explicitly. }
|
||||
{ }
|
||||
{ Handling this message accepts focus; not handling refuses focus. }
|
||||
{ }
|
||||
{ Dispatching: direct }
|
||||
{ }
|
||||
{ Param 1: 1 if you are gaining focus because your child is giving it up, 0 }
|
||||
{ if someone is explicitly giving you focus. }
|
||||
,xpMsg_KeyTakeFocus = 6
|
||||
|
||||
{ Keyboard focus is being taken away from you. The first parameter will be }
|
||||
{ one if you are losing focus because another widget is taking it, or 0 if }
|
||||
{ someone called the API to make you lose focus explicitly. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: 1 if focus is being taken by another widget, 0 if code requested }
|
||||
{ to remove focus. }
|
||||
{ Keyboard focus is being taken away from you. The first parameter will be }
|
||||
{ one if you are losing focus because another widget is taking it, or 0 if }
|
||||
{ someone called the API to make you lose focus explicitly. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: 1 if focus is being taken by another widget, 0 if code requested }
|
||||
{ to remove focus. }
|
||||
,xpMsg_KeyLoseFocus = 7
|
||||
|
||||
{ You receive one mousedown event per click with a mouse-state structure }
|
||||
{ pointed to by parameter 1, by accepting this you eat the click, otherwise }
|
||||
{ your parent gets it. You will not receive drag and mouse up messages if }
|
||||
{ you do not accept the down message. }
|
||||
{ }
|
||||
{ Handling this message consumes the mouse click, not handling it passes it }
|
||||
{ to the next widget. You can act 'transparent' as a window by never handling }
|
||||
{ moues clicks to certain areas. }
|
||||
{ }
|
||||
{ Dispatching: Up chain NOTE: Technically this is direct dispatched, but the }
|
||||
{ widgets library will shop it to each widget until one consumes the click, }
|
||||
{ making it effectively "up chain". }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
{ You receive one mousedown event per click with a mouse-state structure }
|
||||
{ pointed to by parameter 1, by accepting this you eat the click, otherwise }
|
||||
{ your parent gets it. You will not receive drag and mouse up messages if you}
|
||||
{ do not accept the down message. }
|
||||
{ }
|
||||
{ Handling this message consumes the mouse click, not handling it passes it }
|
||||
{ to the next widget. You can act 'transparent' as a window by never handling}
|
||||
{ moues clicks to certain areas. }
|
||||
{ }
|
||||
{ Dispatching: Up chain NOTE: Technically this is direct dispatched, but the }
|
||||
{ widgets library will shop it to each widget until one consumes the click, }
|
||||
{ making it effectively "up chain". }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
,xpMsg_MouseDown = 8
|
||||
|
||||
{ You receive a series of mouse drag messages (typically one per frame in the }
|
||||
{ sim) as the mouse is moved once you have accepted a mouse down message. }
|
||||
{ Parameter one points to a mouse-state structure describing the mouse }
|
||||
{ location. You will continue to receive these until the mouse button is }
|
||||
{ released. You may receive multiple mouse state messages with the same mouse }
|
||||
{ position. You will receive mouse drag events even if the mouse is dragged }
|
||||
{ out of your current or original bounds at the time of the mouse down. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
{ You receive a series of mouse drag messages (typically one per frame in the}
|
||||
{ sim) as the mouse is moved once you have accepted a mouse down message. }
|
||||
{ Parameter one points to a mouse-state structure describing the mouse }
|
||||
{ location. You will continue to receive these until the mouse button is }
|
||||
{ released. You may receive multiple mouse state messages with the same mouse}
|
||||
{ position. You will receive mouse drag events even if the mouse is dragged }
|
||||
{ out of your current or original bounds at the time of the mouse down. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
,xpMsg_MouseDrag = 9
|
||||
|
||||
{ The mouseup event is sent once when the mouse button is released after a }
|
||||
{ drag or click. You only receive this message if you accept the mouseDown }
|
||||
{ message. Parameter one points to a mouse state structure. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
{ The mouseup event is sent once when the mouse button is released after a }
|
||||
{ drag or click. You only receive this message if you accept the mouseDown }
|
||||
{ message. Parameter one points to a mouse state structure. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
,xpMsg_MouseUp = 10
|
||||
|
||||
{ Your geometry or a child's geometry is being changed. }
|
||||
{ }
|
||||
{ Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: The widget ID of the original reshaped target. }
|
||||
{ }
|
||||
{ Param 2: A pointer to a XPWidgetGeometryChange_t struct describing the }
|
||||
{ change. }
|
||||
{ Your geometry or a child's geometry is being changed. }
|
||||
{ }
|
||||
{ Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: The widget ID of the original reshaped target. }
|
||||
{ }
|
||||
{ Param 2: A pointer to a XPWidgetGeometryChange_t struct describing the }
|
||||
{ change. }
|
||||
,xpMsg_Reshape = 11
|
||||
|
||||
{ Your exposed area has changed. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ Your exposed area has changed. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
,xpMsg_ExposedChanged = 12
|
||||
|
||||
{ A child has been added to you. The child's ID is passed in parameter one. }
|
||||
{ }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Widget ID of the child being added. }
|
||||
{ A child has been added to you. The child's ID is passed in parameter one. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Widget ID of the child being added. }
|
||||
,xpMsg_AcceptChild = 13
|
||||
|
||||
{ A child has been removed from to you. The child's ID is passed in }
|
||||
{ parameter one. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Widget ID of the child being removed. }
|
||||
{ A child has been removed from to you. The child's ID is passed in parameter}
|
||||
{ one. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Widget ID of the child being removed. }
|
||||
,xpMsg_LoseChild = 14
|
||||
|
||||
{ You now have a new parent, or have no parent. The parent's ID is passed }
|
||||
{ in, or 0 for no parent. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Widget ID of your parent }
|
||||
{ You now have a new parent, or have no parent. The parent's ID is passed in,}
|
||||
{ or 0 for no parent. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Widget ID of your parent }
|
||||
,xpMsg_AcceptParent = 15
|
||||
|
||||
{ You or a child has been shown. Note that this does not include you being }
|
||||
{ shown because your parent was shown, you were put in a new parent, your }
|
||||
{ root was shown, etc. }
|
||||
{ }
|
||||
{ Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: The widget ID of the shown widget. }
|
||||
{ You or a child has been shown. Note that this does not include you being }
|
||||
{ shown because your parent was shown, you were put in a new parent, your }
|
||||
{ root was shown, etc. }
|
||||
{ }
|
||||
{ Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: The widget ID of the shown widget. }
|
||||
,xpMsg_Shown = 16
|
||||
|
||||
{ You have been hidden. See limitations above. }
|
||||
{ }
|
||||
{ Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: The widget ID of the hidden widget. }
|
||||
{ You have been hidden. See limitations above. }
|
||||
{ }
|
||||
{ Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: The widget ID of the hidden widget. }
|
||||
,xpMsg_Hidden = 17
|
||||
|
||||
{ Your descriptor has changed. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ Your descriptor has changed. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
,xpMsg_DescriptorChanged = 18
|
||||
|
||||
{ A property has changed. Param 1 contains the property ID. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Property ID being changed. }
|
||||
{ }
|
||||
{ Param 2: The new property value }
|
||||
{ A property has changed. Param 1 contains the property ID. }
|
||||
{ }
|
||||
{ Dispatching: Direct }
|
||||
{ }
|
||||
{ Param 1: The Property ID being changed. }
|
||||
{ }
|
||||
{ Param 2: The new property value }
|
||||
,xpMsg_PropertyChanged = 19
|
||||
|
||||
{$IFDEF XPLM200}
|
||||
{ The mouse wheel has moved. }
|
||||
{ }
|
||||
{ Return 1 to consume the mouse wheel move, or 0 to pass the message to a }
|
||||
{ parent. Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
{ The mouse wheel has moved. }
|
||||
{ }
|
||||
{ Return 1 to consume the mouse wheel move, or 0 to pass the message to a }
|
||||
{ parent. Dispatching: Up chain }
|
||||
{ }
|
||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||
,xpMsg_MouseWheel = 20
|
||||
{$ENDIF}
|
||||
{$ENDIF XPLM200}
|
||||
|
||||
{$IFDEF XPLM200}
|
||||
{ The cursor is over your widget. If you consume this message, change the }
|
||||
{ XPLMCursorStatus value to indicate the desired result, with the same rules }
|
||||
{ as in XPLMDisplay.h. }
|
||||
{ }
|
||||
{ Return 1 to consume this message, 0 to pass it on. }
|
||||
{ }
|
||||
{ Dispatching: Up chain Param 1: A pointer to an XPMouseState_t struct }
|
||||
{ containing the mouse status. }
|
||||
{ }
|
||||
{ Param 2: A pointer to a XPLMCursorStatus - set this to the cursor result }
|
||||
{ you desire. }
|
||||
{ The cursor is over your widget. If you consume this message, change the }
|
||||
{ XPLMCursorStatus value to indicate the desired result, with the same rules }
|
||||
{ as in XPLMDisplay.h. }
|
||||
{ }
|
||||
{ Return 1 to consume this message, 0 to pass it on. }
|
||||
{ }
|
||||
{ Dispatching: Up chain Param 1: A pointer to an XPMouseState_t struct }
|
||||
{ containing the mouse status. }
|
||||
{ }
|
||||
{ Param 2: A pointer to a XPLMCursorStatus - set this to the cursor result }
|
||||
{ you desire. }
|
||||
,xpMsg_CursorAdjust = 21
|
||||
{$ENDIF}
|
||||
{$ENDIF XPLM200}
|
||||
|
||||
{ NOTE: Message IDs 1000 - 9999 are allocated to the standard widget classes }
|
||||
{ provided with the library with 1000 - 1099 for widget class 0, 1100 - 1199 }
|
||||
{ for widget class 1, etc. Message IDs 10,000 and beyond are for plugin use. }
|
||||
{ NOTE: Message IDs 1000 - 9999 are allocated to the standard widget classes }
|
||||
{ provided with the library with 1000 - 1099 for widget class 0, 1100 - 1199 }
|
||||
{ for widget class 1, etc. Message IDs 10,000 and beyond are for plugin use. }
|
||||
,xpMsg_UserStart = 10000
|
||||
|
||||
);
|
||||
@@ -415,27 +403,25 @@ TYPE
|
||||
{___________________________________________________________________________
|
||||
* WIDGET CALLBACK FUNCTION
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPWidgetFunc_t
|
||||
|
||||
This function defines your custom widget's behavior. It will be called by
|
||||
the widgets library to send messages to your widget. The message and
|
||||
widget ID are passed in, as well as two ptr-width signed parameters whose
|
||||
meaning varies with the message. Return 1 to indicate that you have
|
||||
processed the message, 0 to indicate that you have not. For any message
|
||||
that is not understood, return 0.
|
||||
This function defines your custom widget's behavior. It will be called by
|
||||
the widgets library to send messages to your widget. The message and widget
|
||||
ID are passed in, as well as two ptr-width signed parameters whose meaning
|
||||
varies with the message. Return 1 to indicate that you have processed the
|
||||
message, 0 to indicate that you have not. For any message that is not
|
||||
understood, return 0.
|
||||
}
|
||||
TYPE
|
||||
XPWidgetFunc_t = FUNCTION(
|
||||
inMessage : XPWidgetMessage;
|
||||
inWidget : XPWidgetID;
|
||||
inParam1 : intptr_t;
|
||||
inParam2 : intptr_t) : integer; cdecl;
|
||||
inParam2 : intptr_t) : Integer; cdecl;
|
||||
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
END.
|
||||
|
||||
@@ -1,74 +1,70 @@
|
||||
{
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
|
||||
All rights reserved. See license.txt for usage.
|
||||
|
||||
X-Plane SDK Version: 2.1.1
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
}
|
||||
|
||||
UNIT XPWidgetUtils;
|
||||
INTERFACE
|
||||
{
|
||||
XPWidgetUtils - USAGE NOTES
|
||||
## USAGE NOTES
|
||||
|
||||
The XPWidgetUtils library contains useful functions that make writing and
|
||||
using widgets less of a pain.
|
||||
The XPWidgetUtils library contains useful functions that make writing and
|
||||
using widgets less of a pain.
|
||||
|
||||
One set of functions are the widget behavior functions. These functions
|
||||
each add specific useful behaviors to widgets. They can be used in two
|
||||
manners:
|
||||
One set of functions are the widget behavior functions. These functions
|
||||
each add specific useful behaviors to widgets. They can be used in two
|
||||
manners:
|
||||
|
||||
1. You can add a widget behavior function to a widget as a callback proc
|
||||
using the XPAddWidgetCallback function. The widget will gain that
|
||||
behavior. Remember that the last function you add has highest priority.
|
||||
You can use this to change or augment the behavior of an existing finished
|
||||
widget.
|
||||
|
||||
2. You can call a widget function from inside your own widget function.
|
||||
This allows you to include useful behaviors in custom-built widgets. A
|
||||
number of the standard widgets get their behavior from this library. To do
|
||||
this, call the behavior function from your function first. If it returns
|
||||
1, that means it handled the event and you don't need to; simply return 1.
|
||||
1. You can add a widget behavior function to a widget as a callback proc
|
||||
using the XPAddWidgetCallback function. The widget will gain that
|
||||
behavior. Remember that the last function you add has highest priority.
|
||||
You can use this to change or augment the behavior of an existing
|
||||
finished widget.
|
||||
2. You can call a widget function from inside your own widget function.
|
||||
This allows you to include useful behaviors in custom-built widgets. A
|
||||
number of the standard widgets get their behavior from this library. To
|
||||
do this, call the behavior function from your function first. If it
|
||||
returns 1, that means it handled the event and you don't need to; simply
|
||||
return 1.
|
||||
}
|
||||
|
||||
USES XPWidgetDefs;
|
||||
USES
|
||||
XPWidgetDefs;
|
||||
{$A4}
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$DEFINE DELPHI}
|
||||
{$ENDIF}
|
||||
{___________________________________________________________________________
|
||||
* GENERAL UTILITIES
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
XPWidgetCreate_t
|
||||
|
||||
This structure contains all of the parameters needed to create a wiget. It
|
||||
is used with XPUCreateWidgets to create widgets in bulk from an array. All
|
||||
parameters correspond to those of XPCreateWidget except for the container
|
||||
index. If the container index is equal to the index of a widget in the
|
||||
array, the widget in the array passed to XPUCreateWidgets is used as the
|
||||
parent of this widget. Note that if you pass an index greater than your
|
||||
own position in the array, the parent you are requesting will not exist
|
||||
yet. If the container index is NO_PARENT, the parent widget is specified as
|
||||
NULL. If the container index is PARAM_PARENT, the widget passed into
|
||||
XPUCreateWidgets is used.
|
||||
This structure contains all of the parameters needed to create a wiget. It
|
||||
is used with XPUCreateWidgets to create widgets in bulk from an array. All
|
||||
parameters correspond to those of XPCreateWidget except for the container
|
||||
index.
|
||||
|
||||
If the container index is equal to the index of a widget in the array, the
|
||||
widget in the array passed to XPUCreateWidgets is used as the parent of
|
||||
this widget. Note that if you pass an index greater than your own position
|
||||
in the array, the parent you are requesting will not exist yet.
|
||||
|
||||
If the container index is NO_PARENT, the parent widget is specified as
|
||||
NULL. If the container index is PARAM_PARENT, the widget passed into
|
||||
XPUCreateWidgets is used.
|
||||
}
|
||||
TYPE
|
||||
XPWidgetCreate_t = RECORD
|
||||
left : integer;
|
||||
top : integer;
|
||||
right : integer;
|
||||
bottom : integer;
|
||||
visible : integer;
|
||||
descriptor : Pchar;
|
||||
isRoot : integer;
|
||||
containerIndex : integer;
|
||||
left : Integer;
|
||||
top : Integer;
|
||||
right : Integer;
|
||||
bottom : Integer;
|
||||
visible : Integer;
|
||||
descriptor : XPLMString;
|
||||
{ Whether ethis widget is a root wiget }
|
||||
isRoot : Integer;
|
||||
{ The index of the widget to contain within, or a constant }
|
||||
containerIndex : Integer;
|
||||
widgetClass : XPWidgetClass;
|
||||
END;
|
||||
PXPWidgetCreate_t = ^XPWidgetCreate_t;
|
||||
@@ -82,144 +78,120 @@ CONST
|
||||
{
|
||||
XPUCreateWidgets
|
||||
|
||||
This function creates a series of widgets from a table...see
|
||||
XPCreateWidget_t above. Pass in an array of widget creation structures and
|
||||
an array of widget IDs that will receive each widget.
|
||||
This function creates a series of widgets from a table (see
|
||||
XPCreateWidget_t above). Pass in an array of widget creation structures and
|
||||
an array of widget IDs that will receive each widget.
|
||||
|
||||
Widget parents are specified by index into the created widget table,
|
||||
allowing you to create nested widget structures. You can create multiple
|
||||
widget trees in one table. Generally you should create widget trees from
|
||||
the top down.
|
||||
Widget parents are specified by index into the created widget table,
|
||||
allowing you to create nested widget structures. You can create multiple
|
||||
widget trees in one table. Generally you should create widget trees from
|
||||
the top down.
|
||||
|
||||
You can also pass in a widget ID that will be used when the widget's parent
|
||||
is listed as PARAM_PARENT; this allows you to embed widgets created with
|
||||
XPUCreateWidgets in a widget created previously.
|
||||
You can also pass in a widget ID that will be used when the widget's parent
|
||||
is listed as PARAM_PARENT; this allows you to embed widgets created with
|
||||
XPUCreateWidgets in a widget created previously.
|
||||
}
|
||||
PROCEDURE XPUCreateWidgets(
|
||||
inWidgetDefs : PXPWidgetCreate_t;
|
||||
inCount : integer;
|
||||
inCount : Integer;
|
||||
inParamParent : XPWidgetID;
|
||||
ioWidgets : PXPWidgetID);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPUMoveWidgetBy
|
||||
|
||||
Simply moves a widget by an amount, +x = right, +y=up, without resizing the
|
||||
widget.
|
||||
Simply moves a widget by an amount, +x = right, +y=up, without resizing the
|
||||
widget.
|
||||
}
|
||||
PROCEDURE XPUMoveWidgetBy(
|
||||
inWidget : XPWidgetID;
|
||||
inDeltaX : integer;
|
||||
inDeltaY : integer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inDeltaX : Integer;
|
||||
inDeltaY : Integer);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{___________________________________________________________________________
|
||||
* LAYOUT MANAGERS
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
The layout managers are widget behavior functions for handling where
|
||||
widgets move. Layout managers can be called from a widget function or
|
||||
attached to a widget later.
|
||||
The layout managers are widget behavior functions for handling where
|
||||
widgets move. Layout managers can be called from a widget function or
|
||||
attached to a widget later.
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
XPUFixedLayout
|
||||
|
||||
This function causes the widget to maintain its children in fixed position
|
||||
relative to itself as it is resized. Use this on the top level 'window'
|
||||
widget for your window.
|
||||
This function causes the widget to maintain its children in fixed position
|
||||
relative to itself as it is resized. Use this on the top level 'window'
|
||||
widget for your window.
|
||||
}
|
||||
FUNCTION XPUFixedLayout(
|
||||
inMessage : XPWidgetMessage;
|
||||
inWidget : XPWidgetID;
|
||||
inParam1 : intptr_t;
|
||||
inParam2 : intptr_t) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inParam2 : intptr_t) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{___________________________________________________________________________
|
||||
* WIDGET PROC BEHAVIORS
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
These widget behavior functions add other useful behaviors to widgets.
|
||||
These functions cannot be attached to a widget; they must be called from
|
||||
your widget function.
|
||||
These widget behavior functions add other useful behaviors to widgets.
|
||||
These functions cannot be attached to a widget; they must be called from
|
||||
your widget function.
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
XPUSelectIfNeeded
|
||||
|
||||
This causes the widget to bring its window to the foreground if it is not
|
||||
already. inEatClick specifies whether clicks in the background should be
|
||||
consumed by bringin the window to the foreground.
|
||||
This causes the widget to bring its window to the foreground if it is not
|
||||
already. inEatClick specifies whether clicks in the background should be
|
||||
consumed by bringin the window to the foreground.
|
||||
}
|
||||
FUNCTION XPUSelectIfNeeded(
|
||||
inMessage : XPWidgetMessage;
|
||||
inWidget : XPWidgetID;
|
||||
inParam1 : intptr_t;
|
||||
inParam2 : intptr_t;
|
||||
inEatClick : integer) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inEatClick : Integer) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPUDefocusKeyboard
|
||||
|
||||
This causes a click in the widget to send keyboard focus back to X-Plane.
|
||||
This stops editing of any text fields, etc.
|
||||
This causes a click in the widget to send keyboard focus back to X-Plane.
|
||||
This stops editing of any text fields, etc.
|
||||
}
|
||||
FUNCTION XPUDefocusKeyboard(
|
||||
inMessage : XPWidgetMessage;
|
||||
inWidget : XPWidgetID;
|
||||
inParam1 : intptr_t;
|
||||
inParam2 : intptr_t;
|
||||
inEatClick : integer) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inEatClick : Integer) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPUDragWidget
|
||||
|
||||
XPUDragWidget drags the widget in response to mouse clicks. Pass in not
|
||||
only the event, but the global coordinates of the drag region, which might
|
||||
be a sub-region of your widget (for example, a title bar).
|
||||
XPUDragWidget drags the widget in response to mouse clicks. Pass in not
|
||||
only the event, but the global coordinates of the drag region, which might
|
||||
be a sub-region of your widget (for example, a title bar).
|
||||
}
|
||||
FUNCTION XPUDragWidget(
|
||||
inMessage : XPWidgetMessage;
|
||||
inWidget : XPWidgetID;
|
||||
inParam1 : intptr_t;
|
||||
inParam2 : intptr_t;
|
||||
inLeft : integer;
|
||||
inTop : integer;
|
||||
inRight : integer;
|
||||
inBottom : integer) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inLeft : Integer;
|
||||
inTop : Integer;
|
||||
inRight : Integer;
|
||||
inBottom : Integer) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
END.
|
||||
|
||||
+283
-421
@@ -1,665 +1,527 @@
|
||||
{
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
|
||||
All rights reserved. See license.txt for usage.
|
||||
|
||||
X-Plane SDK Version: 2.1.1
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
}
|
||||
|
||||
UNIT XPWidgets;
|
||||
INTERFACE
|
||||
{
|
||||
WIDGETS - THEORY OF OPERATION AND NOTES
|
||||
## THEORY OF OPERATION AND NOTES
|
||||
|
||||
Widgets are persistent view 'objects' for X-Plane. A widget is an object
|
||||
referenced by its opaque handle (widget ID) and the APIs in this file. You
|
||||
cannot access the widget's guts directly. Every Widget has the following
|
||||
intrinsic data:
|
||||
Widgets are persistent view 'objects' for X-Plane. A widget is an object
|
||||
referenced by its opaque handle (widget ID) and the APIs in this file. You
|
||||
cannot access the widget's guts directly. Every Widget has the following
|
||||
intrinsic data:
|
||||
|
||||
- A bounding box defined in global screen coordinates with 0,0 in the
|
||||
bottom left and +y = up, +x = right.
|
||||
- A bounding box defined in global screen coordinates with 0,0 in the
|
||||
bottom left and +y = up, +x = right.
|
||||
- A visible box, which is the intersection of the bounding box with the
|
||||
widget's parents visible box.
|
||||
- Zero or one parent widgets. (Always zero if the widget is a root widget.
|
||||
- Zero or more child widgets.
|
||||
- Whether the widget is a root. Root widgets are the top level plugin
|
||||
windows.
|
||||
- Whether the widget is visible.
|
||||
- A text string descriptor, whose meaning varies from widget to widget.
|
||||
- An arbitrary set of 32 bit integral properties defined by 32-bit integral
|
||||
keys. This is how specific widgets store specific data.
|
||||
- A list of widget callbacks proc that implements the widgets behaviors.
|
||||
|
||||
- A visible box, which is the intersection of the bounding box with the
|
||||
widget's parents visible box.
|
||||
The Widgets library sends messages to widgets to request specific behaviors
|
||||
or notify the widget of things.
|
||||
|
||||
- Zero or one parent widgets. (Always zero if the widget is a root widget.
|
||||
Widgets may have more than one callback function, in which case messages
|
||||
are sent to the most recently added callback function until the message is
|
||||
handled. Messages may also be sent to parents or children; see the
|
||||
XPWidgetDefs.h header file for the different widget message dispatching
|
||||
functions. By adding a callback function to a window you can 'subclass' its
|
||||
behavior.
|
||||
|
||||
A set of standard widgets are provided that serve common UI purposes. You
|
||||
can also customize or implement entirely custom widgets.
|
||||
|
||||
- Zero or more child widgets.
|
||||
Widgets are different than other view hierarchies (most notably Win32,
|
||||
which they bear a striking resemblance to) in the following ways:
|
||||
|
||||
- Whether the widget is a root. Root widgets are the top level plugin
|
||||
windows.
|
||||
|
||||
- Whether the widget is visible.
|
||||
|
||||
- A text string descriptor, whose meaning varies from widget to widget.
|
||||
|
||||
- An arbitrary set of 32 bit integral properties defined by 32-bit integral
|
||||
keys. This is how specific widgets
|
||||
|
||||
store specific data.
|
||||
|
||||
- A list of widget callbacks proc that implements the widgets behaviors.
|
||||
|
||||
The Widgets library sends messages to widgets to request specific behaviors
|
||||
or notify the widget of things.
|
||||
|
||||
Widgets may have more than one callback function, in which case messages
|
||||
are sent to the most recently added callback function until the message is
|
||||
handled. Messages may also be sent to parents or children; see the
|
||||
XPWidgetDefs.h header file for the different widget message dispatching
|
||||
functions. By adding a callback function to a window you can 'subclass'
|
||||
its behavior.
|
||||
|
||||
A set of standard widgets are provided that serve common UI purposes. You
|
||||
can also customize or implement entirely custom widgets.
|
||||
|
||||
Widgets are different than other view hierarchies (most notably Win32,
|
||||
which they bear a striking resemblance to) in the following ways:
|
||||
|
||||
- Not all behavior can be patched. State that is managed by the XPWidgets
|
||||
DLL and not by individual widgets cannot be customized.
|
||||
|
||||
- All coordinates are in global screen coordinates. Coordinates are not
|
||||
relative to an enclosing widget, nor are they relative to a display window.
|
||||
|
||||
|
||||
- Widget messages are always dispatched synchronously, and there is no
|
||||
concept of scheduling an update or a dirty region. Messages originate from
|
||||
X-Plane as the sim cycle goes by. Since x-plane is constantly redrawing,
|
||||
so are widgets; there is no need to mark a part of a widget as 'needing
|
||||
redrawing' because redrawing happens frequently whether the widget needs it
|
||||
or not.
|
||||
|
||||
- Any widget may be a 'root' widget, causing it to be drawn; there is no
|
||||
relationship between widget class and rootness. Root widgets are
|
||||
imlemented as XPLMDisply windows.
|
||||
- Not all behavior can be patched. State that is managed by the XPWidgets
|
||||
DLL and not by individual widgets cannot be customized.
|
||||
- All coordinates are in global screen coordinates. Coordinates are not
|
||||
relative to an enclosing widget, nor are they relative to a display
|
||||
window.
|
||||
- Widget messages are always dispatched synchronously, and there is no
|
||||
concept of scheduling an update or a dirty region. Messages originate
|
||||
from X-Plane as the sim cycle goes by. Since X-Plane is constantly
|
||||
redrawing, so are widgets; there is no need to mark a part of a widget as
|
||||
'needing redrawing' because redrawing happens frequently whether the
|
||||
widget needs it or not.
|
||||
- Any widget may be a 'root' widget, causing it to be drawn; there is no
|
||||
relationship between widget class and rootness. Root widgets are
|
||||
imlemented as XPLMDisply windows.
|
||||
}
|
||||
|
||||
USES XPWidgetDefs;
|
||||
USES
|
||||
XPWidgetDefs, XPLMDisplay;
|
||||
{$A4}
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$DEFINE DELPHI}
|
||||
{$ENDIF}
|
||||
{___________________________________________________________________________
|
||||
* WIDGET CREATION AND MANAGEMENT
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPCreateWidget
|
||||
|
||||
This function creates a new widget and returns the new widget's ID to you.
|
||||
If the widget creation fails for some reason, it returns NULL. Widget
|
||||
creation will fail either if you pass a bad class ID or if there is not
|
||||
adequate memory.
|
||||
This function creates a new widget and returns the new widget's ID to you.
|
||||
If the widget creation fails for some reason, it returns NULL. Widget
|
||||
creation will fail either if you pass a bad class ID or if there is not
|
||||
adequate memory.
|
||||
|
||||
Input Parameters:
|
||||
Input Parameters:
|
||||
|
||||
- Top, left, bottom, and right in global screen coordinates defining the
|
||||
widget's location on the screen.
|
||||
- Top, left, bottom, and right in global screen coordinates defining the
|
||||
widget's location on the screen.
|
||||
- inVisible is 1 if the widget should be drawn, 0 to start the widget as
|
||||
hidden.
|
||||
- inDescriptor is a null terminated string that will become the widget's
|
||||
descriptor.
|
||||
- inIsRoot is 1 if this is going to be a root widget, 0 if it will not be.
|
||||
- inContainer is the ID of this widget's container. It must be 0 for a root
|
||||
widget. for a non-root widget, pass the widget ID of the widget to place
|
||||
this widget within. If this widget is not going to start inside another
|
||||
widget, pass 0; this new widget will then just be floating off in space
|
||||
(and will not be drawn until it is placed in a widget.
|
||||
- inClass is the class of the widget to draw. Use one of the predefined
|
||||
class-IDs to create a standard widget.
|
||||
|
||||
- inVisible is 1 if the widget should be drawn, 0 to start the widget as
|
||||
hidden.
|
||||
|
||||
- inDescriptor is a null terminated string that will become the widget's
|
||||
descriptor.
|
||||
|
||||
- inIsRoot is 1 if this is going to be a root widget, 0 if it will not be.
|
||||
|
||||
- inContainer is the ID of this widget's container. It must be 0 for a
|
||||
root widget. for a non-root widget, pass the widget ID of the widget to
|
||||
place this widget within. If this widget is not going to start inside
|
||||
another widget, pass 0; this new widget will then just be floating off in
|
||||
space (and will not be drawn until it is placed in a widget.
|
||||
|
||||
- inClass is the class of the widget to draw. Use one of the predefined
|
||||
class-IDs to create a standard widget.
|
||||
|
||||
A note on widget embedding: a widget is only called (and will be drawn,
|
||||
etc.) if it is placed within a widget that will be called. Root widgets
|
||||
are always called. So it is possible to have whole chains of widgets that
|
||||
are simply not called. You can preconstruct widget trees and then place
|
||||
them into root widgets later to activate them if you wish.
|
||||
A note on widget embedding: a widget is only called (and will be drawn,
|
||||
etc.) if it is placed within a widget that will be called. Root widgets are
|
||||
always called. So it is possible to have whole chains of widgets that are
|
||||
simply not called. You can preconstruct widget trees and then place them
|
||||
into root widgets later to activate them if you wish.
|
||||
}
|
||||
FUNCTION XPCreateWidget(
|
||||
inLeft : integer;
|
||||
inTop : integer;
|
||||
inRight : integer;
|
||||
inBottom : integer;
|
||||
inVisible : integer;
|
||||
inDescriptor : Pchar;
|
||||
inIsRoot : integer;
|
||||
inLeft : Integer;
|
||||
inTop : Integer;
|
||||
inRight : Integer;
|
||||
inBottom : Integer;
|
||||
inVisible : Integer;
|
||||
inDescriptor : XPLMString;
|
||||
inIsRoot : Integer;
|
||||
inContainer : XPWidgetID;
|
||||
inClass : XPWidgetClass) : XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPCreateCustomWidget
|
||||
|
||||
This function is the same as XPCreateWidget except that instead of passing
|
||||
a class ID, you pass your widget callback function pointer defining the
|
||||
widget. Use this function to define a custom widget. All parameters are
|
||||
the same as XPCreateWidget, except that the widget class has been replaced
|
||||
with the widget function.
|
||||
This function is the same as XPCreateWidget except that instead of passing
|
||||
a class ID, you pass your widget callback function pointer defining the
|
||||
widget. Use this function to define a custom widget. All parameters are the
|
||||
same as XPCreateWidget, except that the widget class has been replaced with
|
||||
the widget function.
|
||||
}
|
||||
FUNCTION XPCreateCustomWidget(
|
||||
inLeft : integer;
|
||||
inTop : integer;
|
||||
inRight : integer;
|
||||
inBottom : integer;
|
||||
inVisible : integer;
|
||||
inDescriptor : Pchar;
|
||||
inIsRoot : integer;
|
||||
inLeft : Integer;
|
||||
inTop : Integer;
|
||||
inRight : Integer;
|
||||
inBottom : Integer;
|
||||
inVisible : Integer;
|
||||
inDescriptor : XPLMString;
|
||||
inIsRoot : Integer;
|
||||
inContainer : XPWidgetID;
|
||||
inCallback : XPWidgetFunc_t) : XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPDestroyWidget
|
||||
|
||||
This class destroys a widget. Pass in the ID of the widget to kill. If
|
||||
you pass 1 for inDestroyChilren, the widget's children will be destroyed
|
||||
first, then this widget will be destroyed. (Furthermore, the widget's
|
||||
children will be destroyed with the inDestroyChildren flag set to 1, so the
|
||||
destruction will recurse down the widget tree.) If you pass 0 for this
|
||||
flag, the child widgets will simply end up with their parent set to 0.
|
||||
This class destroys a widget. Pass in the ID of the widget to kill. If you
|
||||
pass 1 for inDestroyChilren, the widget's children will be destroyed first,
|
||||
then this widget will be destroyed. (Furthermore, the widget's children
|
||||
will be destroyed with the inDestroyChildren flag set to 1, so the
|
||||
destruction will recurse down the widget tree.) If you pass 0 for this
|
||||
flag, the child widgets will simply end up with their parent set to 0.
|
||||
}
|
||||
PROCEDURE XPDestroyWidget(
|
||||
inWidget : XPWidgetID;
|
||||
inDestroyChildren : integer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inDestroyChildren : Integer);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPSendMessageToWidget
|
||||
|
||||
This sends any message to a widget. You should probably not go around
|
||||
simulating the predefined messages that the widgets library defines for
|
||||
you. You may however define custom messages for your widgets and send them
|
||||
with this method.
|
||||
This sends any message to a widget. You should probably not go around
|
||||
simulating the predefined messages that the widgets library defines for
|
||||
you. You may however define custom messages for your widgets and send them
|
||||
with this method.
|
||||
|
||||
This method supports several dispatching patterns; see XPDispatchMode for
|
||||
more info. The function returns 1 if the message was handled, 0 if it was
|
||||
not.
|
||||
This method supports several dispatching patterns; see XPDispatchMode for
|
||||
more info. The function returns 1 if the message was handled, 0 if it was
|
||||
not.
|
||||
|
||||
For each widget that receives the message (see the dispatching modes), each
|
||||
widget function from the most recently installed to the oldest one
|
||||
receives the message in order until it is handled.
|
||||
For each widget that receives the message (see the dispatching modes), each
|
||||
widget function from the most recently installed to the oldest one receives
|
||||
the message in order until it is handled.
|
||||
}
|
||||
FUNCTION XPSendMessageToWidget(
|
||||
inWidget : XPWidgetID;
|
||||
inMessage : XPWidgetMessage;
|
||||
inMode : XPDispatchMode;
|
||||
inParam1 : intptr_t;
|
||||
inParam2 : intptr_t) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inParam2 : intptr_t) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{___________________________________________________________________________
|
||||
* WIDGET POSITIONING AND VISIBILITY
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPPlaceWidgetWithin
|
||||
|
||||
This function changes which container a widget resides in. You may NOT use
|
||||
this function on a root widget! inSubWidget is the widget that will be
|
||||
moved. Pass a widget ID in inContainer to make inSubWidget be a child of
|
||||
inContainer. It will become the last/closest widget in the container.
|
||||
Pass 0 to remove the widget from any container. Any call to this other
|
||||
than passing the widget ID of the old parent of the affected widget will
|
||||
cause the widget to be removed from its old parent. Placing a widget within
|
||||
its own parent simply makes it the last widget.
|
||||
This function changes which container a widget resides in. You may NOT use
|
||||
this function on a root widget! inSubWidget is the widget that will be
|
||||
moved. Pass a widget ID in inContainer to make inSubWidget be a child of
|
||||
inContainer. It will become the last/closest widget in the container. Pass
|
||||
0 to remove the widget from any container. Any call to this other than
|
||||
passing the widget ID of the old parent of the affected widget will cause
|
||||
the widget to be removed from its old parent. Placing a widget within its
|
||||
own parent simply makes it the last widget.
|
||||
|
||||
NOTE: this routine does not reposition the sub widget in global
|
||||
coordinates. If the container has layout management code, it will
|
||||
reposition the subwidget for you, otherwise you must do it with
|
||||
SetWidgetGeometry.
|
||||
NOTE: this routine does not reposition the sub widget in global
|
||||
coordinates. If the container has layout management code, it will
|
||||
reposition the subwidget for you, otherwise you must do it with
|
||||
SetWidgetGeometry.
|
||||
}
|
||||
PROCEDURE XPPlaceWidgetWithin(
|
||||
inSubWidget : XPWidgetID;
|
||||
inContainer : XPWidgetID);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPCountChildWidgets
|
||||
|
||||
This routine returns the number of widgets another widget contains.
|
||||
This routine returns the number of widgets another widget contains.
|
||||
}
|
||||
FUNCTION XPCountChildWidgets(
|
||||
inWidget : XPWidgetID) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inWidget : XPWidgetID) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetNthChildWidget
|
||||
|
||||
This routine returns the widget ID of a child widget by index. Indexes are
|
||||
0 based, from 0 to one minus the number of widgets in the parent,
|
||||
inclusive. If the index is invalid, 0 is returned.
|
||||
This routine returns the widget ID of a child widget by index. Indexes are
|
||||
0 based, from 0 to one minus the number of widgets in the parent,
|
||||
inclusive. If the index is invalid, 0 is returned.
|
||||
}
|
||||
FUNCTION XPGetNthChildWidget(
|
||||
inWidget : XPWidgetID;
|
||||
inIndex : integer) : XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inIndex : Integer) : XPWidgetID;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetParentWidget
|
||||
|
||||
This routine returns the parent of a widget, or 0 if the widget has no
|
||||
parent. Root widgets never have parents and therefore always return 0.
|
||||
Returns the parent of a widget, or 0 if the widget has no parent. Root
|
||||
widgets never have parents and therefore always return 0.
|
||||
}
|
||||
FUNCTION XPGetParentWidget(
|
||||
inWidget : XPWidgetID) : XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPShowWidget
|
||||
|
||||
This routine makes a widget visible if it is not already. Note that if a
|
||||
widget is not in a rooted widget hierarchy or one of its parents is not
|
||||
visible, it will still not be visible to the user.
|
||||
This routine makes a widget visible if it is not already. Note that if a
|
||||
widget is not in a rooted widget hierarchy or one of its parents is not
|
||||
visible, it will still not be visible to the user.
|
||||
}
|
||||
PROCEDURE XPShowWidget(
|
||||
inWidget : XPWidgetID);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPHideWidget
|
||||
|
||||
Makes a widget invisible. See XPShowWidget for considerations of when a
|
||||
widget might not be visible despite its own visibility state.
|
||||
Makes a widget invisible. See XPShowWidget for considerations of when a
|
||||
widget might not be visible despite its own visibility state.
|
||||
}
|
||||
PROCEDURE XPHideWidget(
|
||||
inWidget : XPWidgetID);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPIsWidgetVisible
|
||||
|
||||
This returns 1 if a widget is visible, 0 if it is not. Note that this
|
||||
routine takes into consideration whether a parent is invisible. Use this
|
||||
routine to tell if the user can see the widget.
|
||||
This returns 1 if a widget is visible, 0 if it is not. Note that this
|
||||
routine takes into consideration whether a parent is invisible. Use this
|
||||
routine to tell if the user can see the widget.
|
||||
}
|
||||
FUNCTION XPIsWidgetVisible(
|
||||
inWidget : XPWidgetID) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inWidget : XPWidgetID) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPFindRootWidget
|
||||
|
||||
XPFindRootWidget returns the Widget ID of the root widget that contains the
|
||||
passed in widget or NULL if the passed in widget is not in a rooted
|
||||
hierarchy.
|
||||
Returns the Widget ID of the root widget that contains the passed in widget
|
||||
or NULL if the passed in widget is not in a rooted hierarchy.
|
||||
}
|
||||
FUNCTION XPFindRootWidget(
|
||||
inWidget : XPWidgetID) : XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPBringRootWidgetToFront
|
||||
|
||||
This routine makes the specified widget be in the front most widget
|
||||
hierarchy. If this widget is a root widget, its widget hierarchy comes to
|
||||
front, otherwise the widget's root is brought to the front. If this widget
|
||||
is not in an active widget hiearchy (e.g. there is no root widget at the
|
||||
top of the tree), this routine does nothing.
|
||||
This routine makes the specified widget be in the front most widget
|
||||
hierarchy. If this widget is a root widget, its widget hierarchy comes to
|
||||
front, otherwise the widget's root is brought to the front. If this widget
|
||||
is not in an active widget hiearchy (e.g. there is no root widget at the
|
||||
top of the tree), this routine does nothing.
|
||||
}
|
||||
PROCEDURE XPBringRootWidgetToFront(
|
||||
inWidget : XPWidgetID);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPIsWidgetInFront
|
||||
|
||||
This routine returns true if this widget's hierarchy is the front most
|
||||
hierarchy. It returns false if the widget's hierarchy is not in front, or
|
||||
if the widget is not in a rooted hierarchy.
|
||||
This routine returns true if this widget's hierarchy is the front most
|
||||
hierarchy. It returns false if the widget's hierarchy is not in front, or
|
||||
if the widget is not in a rooted hierarchy.
|
||||
}
|
||||
FUNCTION XPIsWidgetInFront(
|
||||
inWidget : XPWidgetID) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inWidget : XPWidgetID) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetGeometry
|
||||
|
||||
This routine returns the bounding box of a widget in global coordinates.
|
||||
Pass NULL for any parameter you are not interested in.
|
||||
This routine returns the bounding box of a widget in global coordinates.
|
||||
Pass NULL for any parameter you are not interested in.
|
||||
}
|
||||
PROCEDURE XPGetWidgetGeometry(
|
||||
inWidget : XPWidgetID;
|
||||
outLeft : Pinteger; { Can be nil }
|
||||
outTop : Pinteger; { Can be nil }
|
||||
outRight : Pinteger; { Can be nil }
|
||||
outBottom : Pinteger); { Can be nil }
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
outLeft : PInteger; { Can be nil }
|
||||
outTop : PInteger; { Can be nil }
|
||||
outRight : PInteger; { Can be nil }
|
||||
outBottom : PInteger); { Can be nil }
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPSetWidgetGeometry
|
||||
|
||||
This function changes the bounding box of a widget.
|
||||
This function changes the bounding box of a widget.
|
||||
}
|
||||
PROCEDURE XPSetWidgetGeometry(
|
||||
inWidget : XPWidgetID;
|
||||
inLeft : integer;
|
||||
inTop : integer;
|
||||
inRight : integer;
|
||||
inBottom : integer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inLeft : Integer;
|
||||
inTop : Integer;
|
||||
inRight : Integer;
|
||||
inBottom : Integer);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetForLocation
|
||||
|
||||
Given a widget and a location, this routine returns the widget ID of the
|
||||
child of that widget that owns that location. If inRecursive is true then
|
||||
this will return a child of a child of a widget as it tries to find the
|
||||
deepest widget at that location. If inVisibleOnly is true, then only
|
||||
visible widgets are considered, otherwise all widgets are considered. The
|
||||
widget ID passed for inContainer will be returned if the location is in
|
||||
that widget but not in a child widget. 0 is returned if the location is
|
||||
not in the container.
|
||||
Given a widget and a location, this routine returns the widget ID of the
|
||||
child of that widget that owns that location. If inRecursive is true then
|
||||
this will return a child of a child of a widget as it tries to find the
|
||||
deepest widget at that location. If inVisibleOnly is true, then only
|
||||
visible widgets are considered, otherwise all widgets are considered. The
|
||||
widget ID passed for inContainer will be returned if the location is in
|
||||
that widget but not in a child widget. 0 is returned if the location is not
|
||||
in the container.
|
||||
|
||||
NOTE: if a widget's geometry extends outside its parents geometry, it will
|
||||
not be returned by this call for mouse locations outside the parent
|
||||
geometry. The parent geometry limits the child's eligibility for mouse
|
||||
location.
|
||||
NOTE: if a widget's geometry extends outside its parents geometry, it will
|
||||
not be returned by this call for mouse locations outside the parent
|
||||
geometry. The parent geometry limits the child's eligibility for mouse
|
||||
location.
|
||||
}
|
||||
FUNCTION XPGetWidgetForLocation(
|
||||
inContainer : XPWidgetID;
|
||||
inXOffset : integer;
|
||||
inYOffset : integer;
|
||||
inRecursive : integer;
|
||||
inVisibleOnly : integer) : XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inXOffset : Integer;
|
||||
inYOffset : Integer;
|
||||
inRecursive : Integer;
|
||||
inVisibleOnly : Integer) : XPWidgetID;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetExposedGeometry
|
||||
|
||||
This routine returns the bounds of the area of a widget that is completely
|
||||
within its parent widgets. Since a widget's bounding box can be outside
|
||||
its parent, part of its area will not be elligible for mouse clicks and
|
||||
should not draw. Use XPGetWidgetGeometry to find out what area defines
|
||||
your widget's shape, but use this routine to find out what area to actually
|
||||
draw into. Note that the widget library does not use OpenGL clipping to
|
||||
keep frame rates up, although you could use it internally.
|
||||
This routine returns the bounds of the area of a widget that is completely
|
||||
within its parent widgets. Since a widget's bounding box can be outside its
|
||||
parent, part of its area will not be elligible for mouse clicks and should
|
||||
not draw. Use XPGetWidgetGeometry to find out what area defines your
|
||||
widget's shape, but use this routine to find out what area to actually draw
|
||||
into. Note that the widget library does not use OpenGL clipping to keep
|
||||
frame rates up, although you could use it internally.
|
||||
}
|
||||
PROCEDURE XPGetWidgetExposedGeometry(
|
||||
inWidgetID : XPWidgetID;
|
||||
outLeft : Pinteger; { Can be nil }
|
||||
outTop : Pinteger; { Can be nil }
|
||||
outRight : Pinteger; { Can be nil }
|
||||
outBottom : Pinteger); { Can be nil }
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
outLeft : PInteger; { Can be nil }
|
||||
outTop : PInteger; { Can be nil }
|
||||
outRight : PInteger; { Can be nil }
|
||||
outBottom : PInteger); { Can be nil }
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{___________________________________________________________________________
|
||||
* ACCESSING WIDGET DATA
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPSetWidgetDescriptor
|
||||
|
||||
Every widget has a descriptor, which is a text string. What the text
|
||||
string is used for varies from widget to widget; for example, a push
|
||||
button's text is its descriptor, a caption shows its descriptor, and a text
|
||||
field's descriptor is the text being edited. In other words, the usage for
|
||||
the text varies from widget to widget, but this API provides a universal
|
||||
and convenient way to get at it. While not all UI widgets need their
|
||||
descriptor, many do.
|
||||
Every widget has a descriptor, which is a text string. What the text string
|
||||
is used for varies from widget to widget; for example, a push button's text
|
||||
is its descriptor, a caption shows its descriptor, and a text field's
|
||||
descriptor is the text being edited. In other words, the usage for the text
|
||||
varies from widget to widget, but this API provides a universal and
|
||||
convenient way to get at it. While not all UI widgets need their
|
||||
descriptor, many do.
|
||||
}
|
||||
PROCEDURE XPSetWidgetDescriptor(
|
||||
inWidget : XPWidgetID;
|
||||
inDescriptor : Pchar);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inDescriptor : XPLMString);
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetDescriptor
|
||||
|
||||
This routine returns the widget's descriptor. Pass in the length of the
|
||||
buffer you are going to receive the descriptor in. The descriptor will be
|
||||
null terminated for you. This routine returns the length of the actual
|
||||
descriptor; if you pass NULL for outDescriptor, you can get the
|
||||
descriptor's length without getting its text. If the length of the
|
||||
descriptor exceeds your buffer length, the buffer will not be null
|
||||
terminated (this routine has 'strncpy' semantics).
|
||||
This routine returns the widget's descriptor. Pass in the length of the
|
||||
buffer you are going to receive the descriptor in. The descriptor will be
|
||||
null terminated for you. This routine returns the length of the actual
|
||||
descriptor; if you pass NULL for outDescriptor, you can get the
|
||||
descriptor's length without getting its text. If the length of the
|
||||
descriptor exceeds your buffer length, the buffer will not be null
|
||||
terminated (this routine has 'strncpy' semantics).
|
||||
}
|
||||
FUNCTION XPGetWidgetDescriptor(
|
||||
inWidget : XPWidgetID;
|
||||
outDescriptor : Pchar;
|
||||
inMaxDescLength : integer) : integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
outDescriptor : XPLMString;
|
||||
inMaxDescLength : Integer) : Integer;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetUnderlyingWindow
|
||||
|
||||
Returns the window (from the XPLMDisplay API) that backs your widget
|
||||
window. If you have opted in to modern windows, via a call to
|
||||
XPLMEnableFeature("XPLM_USE_NATIVE_WIDGET_WINDOWS", 1), you can use the
|
||||
returned window ID for display APIs like XPLMSetWindowPositioningMode(),
|
||||
allowing you to pop the widget window out into a real OS window, or move it
|
||||
into VR.
|
||||
}
|
||||
FUNCTION XPGetWidgetUnderlyingWindow(
|
||||
inWidget : XPWidgetID) : XPLMWindowID;
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPSetWidgetProperty
|
||||
|
||||
This function sets a widget's property. Properties are arbitrary values
|
||||
associated by a widget by ID.
|
||||
This function sets a widget's property. Properties are arbitrary values
|
||||
associated by a widget by ID.
|
||||
}
|
||||
PROCEDURE XPSetWidgetProperty(
|
||||
inWidget : XPWidgetID;
|
||||
inProperty : XPWidgetPropertyID;
|
||||
inValue : intptr_t);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetProperty
|
||||
|
||||
This routine returns the value of a widget's property, or 0 if the property
|
||||
is not defined. If you need to know whether the property is defined, pass
|
||||
a pointer to an int for inExists; the existence of that property will be
|
||||
returned in the int. Pass NULL for inExists if you do not need this
|
||||
information.
|
||||
This routine returns the value of a widget's property, or 0 if the property
|
||||
is not defined. If you need to know whether the property is defined, pass a
|
||||
pointer to an int for inExists; the existence of that property will be
|
||||
returned in the int. Pass NULL for inExists if you do not need this
|
||||
information.
|
||||
}
|
||||
FUNCTION XPGetWidgetProperty(
|
||||
inWidget : XPWidgetID;
|
||||
inProperty : XPWidgetPropertyID;
|
||||
inExists : Pinteger) : intptr_t; { Can be nil }
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
inExists : PInteger) : intptr_t; { Can be nil }
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{___________________________________________________________________________
|
||||
* KEYBOARD MANAGEMENT
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPSetKeyboardFocus
|
||||
|
||||
XPSetKeyboardFocus controls which widget will receive keystrokes. Pass the
|
||||
Widget ID of the widget to get the keys. Note that if the widget does not
|
||||
care about keystrokes, they will go to the parent widget, and if no widget
|
||||
cares about them, they go to X-Plane.
|
||||
Controls which widget will receive keystrokes. Pass the widget ID of the
|
||||
widget to get the keys. Note that if the widget does not care about
|
||||
keystrokes, they will go to the parent widget, and if no widget cares about
|
||||
them, they go to X-Plane.
|
||||
|
||||
If you set the keyboard focus to Widget ID 0, X-Plane gets keyboard focus.
|
||||
If you set the keyboard focus to widget ID 0, X-Plane gets keyboard focus.
|
||||
|
||||
This routine returns the widget ID that ended up with keyboard focus, or 0
|
||||
for x-plane.
|
||||
This routine returns the widget ID that ended up with keyboard focus, or 0
|
||||
for X-Plane.
|
||||
|
||||
Keyboard focus is not changed if the new widget will not accept it. For
|
||||
setting to x-plane, keyboard focus is always accepted.
|
||||
|
||||
}
|
||||
Keyboard focus is not changed if the new widget will not accept it. For
|
||||
setting to X-Plane, keyboard focus is always accepted.
|
||||
}
|
||||
FUNCTION XPSetKeyboardFocus(
|
||||
inWidget : XPWidgetID) : XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPLoseKeyboardFocus
|
||||
|
||||
This causes the specified widget to lose focus; focus is passed to its
|
||||
parent, or the next parent that will accept it. This routine does nothing
|
||||
if this widget does not have focus.
|
||||
This causes the specified widget to lose focus; focus is passed to its
|
||||
parent, or the next parent that will accept it. This routine does nothing
|
||||
if this widget does not have focus.
|
||||
}
|
||||
PROCEDURE XPLoseKeyboardFocus(
|
||||
inWidget : XPWidgetID);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetWithFocus
|
||||
|
||||
This routine returns the widget that has keyboard focus, or 0 if X-Plane
|
||||
has keyboard focus or some other plugin window that does not have widgets
|
||||
has focus.
|
||||
This routine returns the widget that has keyboard focus, or 0 if X-Plane
|
||||
has keyboard focus or some other plugin window that does not have widgets
|
||||
has focus.
|
||||
}
|
||||
FUNCTION XPGetWidgetWithFocus: XPWidgetID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{___________________________________________________________________________
|
||||
* CREATING CUSTOM WIDGETS
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
XPAddWidgetCallback
|
||||
|
||||
This function adds a new widget callback to a widget. This widget callback
|
||||
supercedes any existing ones and will receive messages first; if it does
|
||||
not handle messages they will go on to be handled by pre-existing widgets.
|
||||
This function adds a new widget callback to a widget. This widget callback
|
||||
supercedes any existing ones and will receive messages first; if it does
|
||||
not handle messages they will go on to be handled by pre-existing widgets.
|
||||
|
||||
The widget function will remain on the widget for the life of the widget.
|
||||
The creation message will be sent to the new callback immediately with the
|
||||
widget ID, and the destruction message will be sent before the other widget
|
||||
function receives a destruction message.
|
||||
The widget function will remain on the widget for the life of the widget.
|
||||
The creation message will be sent to the new callback immediately with the
|
||||
widget ID, and the destruction message will be sent before the other widget
|
||||
function receives a destruction message.
|
||||
|
||||
This provides a way to 'subclass' an existing widget. By providing a
|
||||
second hook that only handles certain widget messages, you can customize or
|
||||
extend widget behavior.
|
||||
This provides a way to 'subclass' an existing widget. By providing a second
|
||||
hook that only handles certain widget messages, you can customize or extend
|
||||
widget behavior.
|
||||
}
|
||||
PROCEDURE XPAddWidgetCallback(
|
||||
inWidget : XPWidgetID;
|
||||
inNewCallback : XPWidgetFunc_t);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
{
|
||||
XPGetWidgetClassFunc
|
||||
|
||||
Given a widget class, this function returns the callbacks that power that
|
||||
widget class.
|
||||
Given a widget class, this function returns the callbacks that power that
|
||||
widget class.
|
||||
}
|
||||
FUNCTION XPGetWidgetClassFunc(
|
||||
inWidgetClass : XPWidgetClass) : XPWidgetFunc_t;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPWIDGETS.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPWIDGETS.DLL;
|
||||
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
END.
|
||||
|
||||
Reference in New Issue
Block a user