Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Extension.RootWindow


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
//=============================================================================
// RootWindow.
//=============================================================================
class RootWindow extends ModalWindow
    native
    noexport;

// ----------------------------------------------------------------------
// Execs

#exec FONT    IMPORT FILE=Textures\TechMedium.pcx          NAME=TechMedium
#exec FONT    IMPORT FILE=Textures\TechMedium_DS.pcx       NAME=TechMedium_DS
#exec FONT    IMPORT FILE=Textures\TechMedium_B.pcx        NAME=TechMedium_B
#exec FONT    IMPORT FILE=Textures\TechSmall.pcx           NAME=TechSmall
#exec FONT    IMPORT FILE=Textures\TechSmall_DS.pcx        NAME=TechSmall_DS
#exec FONT    IMPORT FILE=Textures\TechTiny.pcx            NAME=TechTiny
#exec TEXTURE IMPORT FILE=Textures\DefaultCursor.pcx       NAME=DefaultCursor
#exec TEXTURE IMPORT FILE=Textures\DefaultTextCursor.pcx   NAME=DefaultTextCursor
#exec TEXTURE IMPORT FILE=Textures\DefaultMoveCursor.pcx   NAME=DefaultMoveCursor
#exec TEXTURE IMPORT FILE=Textures\DefaultHMoveCursor.pcx  NAME=DefaultHMoveCursor
#exec TEXTURE IMPORT FILE=Textures\DefaultVMoveCursor.pcx  NAME=DefaultVMoveCursor
#exec TEXTURE IMPORT FILE=Textures\DefaultTLMoveCursor.pcx NAME=DefaultTLMoveCursor
#exec TEXTURE IMPORT FILE=Textures\DefaultTRMoveCursor.pcx NAME=DefaultTRMoveCursor
#exec TEXTURE IMPORT FILE=Textures\Solid.pcx               NAME=Solid
#exec TEXTURE IMPORT FILE=Textures\SolidGreen.pcx          NAME=SolidGreen
#exec TEXTURE IMPORT FILE=Textures\SolidYellow.pcx         NAME=SolidYellow
#exec TEXTURE IMPORT FILE=Textures\SolidRed.pcx            NAME=SolidRed
#exec TEXTURE IMPORT FILE=Textures\VisionBlue.pcx          NAME=VisionBlue
#exec TEXTURE IMPORT FILE=Textures\Dithered.pcx            NAME=Dithered


// ----------------------------------------------------------------------
// Variables

var const PlayerPawnExt parentPawn;         // APlayerPawnExt which owns this win

var private RootWindow  nextRootWindow;     // Next root window in global list

// Cursor position info
var private float       mouseX;             // Cursor X pos
var private float       mouseY;             // Cursor Y pos
var private float       prevMouseX;         // Last cursor X pos
var private float       prevMouseY;         // Last cursor Y pos
var private window      lastMouseWindow;    // Last window the cursor was in
var private bool        bMouseMoved;        // TRUE if the mouse moved
var private bool        bMouseMoveLocked;   // TRUE if mouse movement is disabled
var private bool        bMouseButtonLocked; // TRUE if mouse buttons are disabled
var private bool        bCursorVisible;     // TRUE if the cursor is visible

// Default cursors
var private texture     defaultEditCursor;           // Cursor for edit widgets
var private texture     defaultMoveCursor;           // General movement cursor
var private texture     defaultHorizontalMoveCursor; // Horizontal movement cursor
var private texture     defaultVerticalMoveCursor;   // Vertical movement cursor
var private texture     defaultTopLeftMoveCursor;    // Upper left to lower right cursor
var private texture     defaultTopRightMoveCursor;   // Upper right to lower left cursor

// Sound options
var private bool        bPositionalSound;            // TRUE if positional sound is enabled

// Input windows
var const window        grabbedWindow;         // Recipient window for all mouse events
var const window        focusWindow;           // Recipient window for all keyboard events

// Reference counters
var int                 handleMouseRef;        // Should root handle mouse events?
var int                 handleKeyboardRef;     // Should root handle keyboard events?

// Initialization reference counter
var int                 initCount;             // Number of windows to be initialized this tick

// Rendered area information
var private bool        bRender;               // TRUE if 3D areas should be rendered
var private bool        bClipRender;           // TRUE if the 3D area is clipped
var private bool        bStretchRawBackground; // TRUE if raw background should be stretched
var private float       renderX;               // X offset of rendered area
var private float       renderY;               // Y offset of rendered area
var private float       renderWidth;           // Width of rendered area
var private float       renderHeight;          // Height of rendered area
var private texture     rawBackground;         // Background graphic drawn in unrendered areas
var private float       rawBackgroundWidth;    // Width of background graphic
var private float       rawBackgroundHeight;   // Height of background graphic
var private color       rawColor;              // Color of raw background texture

// Statistical variables
var const int           tickCycles;            // Number of cycles used during windows tick
var const int           paintCycles;           // Number of cycles used during PaintWindows call
var bool                bShowStats;            // Should statistics be shown on root window?
var bool                bShowFrames;           // Should we draw debugging frames around all windows?
var texture             debugTexture;          // Debugging texture
var float               frameTimer;            // Timer used for frames


// Button click information used to determine multiple clicks
var float               multiClickTimeout;     // Max amount of time between multiple button clicks
var private float       maxMouseDist;          // Maximum mouse distance for multi-click to work
var private int         clickCount;            // Current click number (zero-based)
var private int         lastButtonType;        // Last mouse button handled
var private float       lastButtonPress;       // Time remaining for last button press
var private window      lastButtonWindow;      // Last window clicked in
var private float       firstButtonMouseX;     // X position of initial button press
var private float       firstButtonMouseY;     // Y position of initial button press

// List of all current key states
var private byte        keyDownMap[0xFF];      // State is TRUE if key is pressed

var private int         hMultiplier;           // Horizontal multiplier
var private int         vMultiplier;           // Vertical multiplier

// Snapshot-related variables
var private int         snapshotWidth;        // Snapshot width
var private int         snapshotHeight;       // Snapshot height

var private transient int rootFrame;           // Transient frame

// ----------------------------------------------------------------------
// Intrinsics

native(1510) final function SetDefaultEditCursor(optional texture newEditCursor);
native(1511) final function SetDefaultMovementCursors(optional texture newMovementCursor,
                                                      optional texture newHorizontalMovementCursor,
                                                      optional texture newVerticalMovementCursor,
                                                      optional texture newTopLeftMovementCursor,
                                                      optional texture newTopRightMovementCursor);
native(1512) final function EnableRendering(optional bool bRender);
native(1513) final function Bool IsRenderingEnabled();
native(1514) final function SetRenderViewport(float newX, float newY,
                                              float newWidth, float newHeight);
native(1515) final function ResetRenderViewport();
native(1516) final function SetRawBackground(optional texture newTexture,
                                             optional color newColor);
native(1517) final function SetRawBackgroundSize(float newWidth, float newHeight);
native(1518) final function StretchRawBackground(optional bool bStretch);

native(1519) final function EnablePositionalSound(optional bool bEnable);
native(1520) final function bool IsPositionalSoundEnabled();

native(1521) final function LockMouse(optional bool bLockMove, optional bool bLockButton);
native(1522) final function ShowCursor(optional bool bShow);

native(1523) final function SetSnapshotSize(float newWidth, float newHeight);
native(1524) final function Texture GenerateSnapshot(optional bool bFilter);

// ----------------------------------------------------------------------
// InitWindow() : Called when this window is initialized

function InitWindow()
{
    Super.InitWindow();
    SetFont(Font'TechMedium');
    SetDefaultCursor(Texture'DefaultCursor');
    SetDefaultEditCursor(Texture'DefaultTextCursor');
    SetDefaultMovementCursors(Texture'DefaultMoveCursor',
                              Texture'DefaultHMoveCursor',
                              Texture'DefaultVMoveCursor',
                              Texture'DefaultTLMoveCursor',
                              Texture'DefaultTRMoveCursor');
}


// ----------------------------------------------------------------------
// Tick() : Work procedure, called periodically

function Tick(float deltaSeconds)
{
}


// ----------------------------------------------------------------------
// VirtualKeyPressed() : Default virtual key handler for the root window

function bool VirtualKeyPressed(EInputKey key, bool bRepeat)
{
    local bool retval;

    // Try the superclass first
    retval = Super.VirtualKeyPressed(key, bRepeat);

    // Didn't handle it -- do it ourselves
    if (!retval)
    {
        retval = true;

        // Handle arrow keys
        if      (key == IK_Left)
            MoveFocusLeft();
        else if (key == IK_Right)
            MoveFocusRight();
        else if (key == IK_Up)
            MoveFocusUp();
        else if (key == IK_Down)
            MoveFocusDown();

        // Handle tab key
        else if (key == IK_Tab)
        {
            if (IsKeyDown(IK_Shift))
                MoveTabGroupPrev();
            else
                MoveTabGroupNext();
        }

        // Handle zilch
        else
            retval = false;
    }

    // Return TRUE if we handled this event
    return (retval);
}


// ----------------------------------------------------------------------
// ClientMessage() : Called when the game wants to tell the player
//                   something

event bool ClientMessage(coerce string msg, optional name type,
                         optional bool bBeep)
{
    return (false);  // don't handle this
}


// ----------------------------------------------------------------------
// GrabKeyboardEvents() : Allows root window to process keyboard events;
//                        uses reference counting

function GrabKeyboardEvents()
{
    handleKeyboardRef++;
}


// ----------------------------------------------------------------------
// UngrabKeyboardEvents() : Prevents root window from processing
//                          keyboard events; uses reference counting

function UngrabKeyboardEvents()
{
    if (handleKeyboardRef > 0)
        handleKeyboardRef--;
}


// ----------------------------------------------------------------------
// GrabMouseEvents() : Allows root window to process mouse events; uses
//                     reference counting

function GrabMouseEvents()
{
    handleMouseRef++;
}


// ----------------------------------------------------------------------
// UngrabMouseEvents() : Prevents root window from processing mouse
//                       events; uses reference counting

function UngrabMouseEvents()
{
    if (handleMouseRef > 0)
        handleMouseRef--;
}


// ----------------------------------------------------------------------
// IsKeyboardGrabbed() : Returns TRUE if the root window can process
//                       keyboard events

function bool IsKeyboardGrabbed()
{
    if (handleKeyboardRef > 0)
        return true;
    else
        return false;
}


// ----------------------------------------------------------------------
// IsMouseGrabbed() : Returns TRUE if the root window can process mouse
//                    events

function bool IsMouseGrabbed()
{
    if (handleMouseRef > 0)
        return true;
    else
        return false;
}


// ----------------------------------------------------------------------
// ShowStats() : Turns the status display on or off

function ShowStats(bool bNewShowStats)
{
    bShowStats = bNewShowStats;
}


// ----------------------------------------------------------------------
// ShowFrames() : Turns window frames on or off

function ShowFrames(bool bNewShowFrames)
{
    bShowFrames = bNewShowFrames;
}

defaultproperties
{
     rawBackground=Texture'Extension.Solid'
     debugTexture=Texture'Extension.Solid'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 8/11/2021 16:22:50.000 - Creation time: Mon 8/11/2021 16:31:31.985 - Created with UnCodeX