1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
|
//=========== Copyright Valve Corporation, All rights reserved. ===============//
//
// Purpose: Public header for panorama UI framework
//
//
//=============================================================================//
#ifndef PANORAMATYPES_H
#define PANORAMATYPES_H
#pragma once
#ifdef POSIX
#include <float.h>
#endif
#include "mathlib/vector.h"
#ifdef SOURCE2_PANORAMA
#include "tier1/mempool.h"
#include "tier1/checksum_sha1.h"
class ISceneView;
class IRenderContext;
class ISceneLayer;
typedef void (RenderCallbackFunction_t)( ISceneView *, IRenderContext **, ISceneLayer *, float, float, float, float );
#endif
#if !defined( SOURCE2_PANORAMA )
#define VPROF_BUDGET_THREAD VPROF_BUDGET
#else
#define VPROF_BUDGET_THREAD( name, group ) ((void)0)
const uint32 k_cubSHA1Hash = k_cubHash;
#ifndef SAFE_DELETE
#define SAFE_DELETE( x ) if ( (x) != NULL ) { delete (x); x = NULL; }
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE( x ) if ( NULL != ( x ) ) { ( x )->Release(); x = NULL; }
#endif
#define AssertFatalMsg2( b, msg, p1, p2 ) AssertFatalMsg( b, msg, p1, p2 )
#define AssertFatalMsg1( b, msg, p1 ) AssertFatalMsg( b, msg, p1 )
template <class T, class P>
inline void ConstructOneArg( T* pMemory, P const& arg )
{
HINT( pMemory != 0 );
::new(pMemory)T( arg );
}
template <class T, class P, class P2 >
inline void ConstructTwoArg( T* pMemory, P const& arg1, P2 const &arg2 )
{
HINT( pMemory != 0 );
::new(pMemory)T( arg1, arg2 );
}
template <class T, class P, class P2, class P3, class P4, class P5, class P6, class P7 >
inline void ConstructSevenArg( T* pMemory, P const& arg1, P2 const &arg2, P3 const &arg3, P4 const &arg4, P5 const &arg5, P6 const &arg6, P7 const &arg7 )
{
HINT( pMemory != 0 );
::new(pMemory)T( arg1, arg2, arg3, arg4, arg5, arg6, arg7 );
}
#endif
namespace panorama
{
class IUIPanelClient;
//-----------------------------------------------------------------------------
// Purpose: Text/font related types
//-----------------------------------------------------------------------------
enum EFontWeight
{
k_EFontWeightUnset = -1,
k_EFontWeightNormal = 0,
k_EFontWeightMedium = 1,
k_EFontWeightBold = 2,
k_EFontWeightBlack = 3,
k_EFontWeightThin = 4,
k_EFontWeightLight = 5,
k_EFontWeightSemiBold = 6,
};
enum EFontStyle
{
k_EFontStyleUnset = -1,
k_EFontStyleNormal = 0,
k_EFontStyleItalic = 2,
};
enum ETextAlign
{
k_ETextAlignUnset = -1,
k_ETextAlignLeft = 0,
k_ETextAlignCenter = 1,
k_ETextAlignRight = 2
};
enum ETextDecoration
{
k_ETextDecorationUnset = -1,
k_ETextDecorationNone = 0,
k_ETextDecorationUnderline = 1,
k_ETextDecorationLineThrough = 2,
};
enum ETextTransform
{
k_ETextTransformUnset = -1,
k_ETextTransformNone = 0,
k_ETextTransformUppercase = 1,
k_ETextTransformLowercase = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Transform related types
//-----------------------------------------------------------------------------
enum ETransform3DType
{
k_ETransform3DRotate,
k_ETransform3DTranslate,
k_ETransform3DScale
};
//-----------------------------------------------------------------------------
// Purpose: Types for border images
//-----------------------------------------------------------------------------
enum EBorderImageRepeatType
{
k_EBorderImageStretchStretch = 0,
k_EBorderImageStretchRepeat = 1,
k_EBorderImageStretchRound = 2,
k_EBorderImageStretchSpace = 3,
};
enum EBorderImageWidthType
{
k_EBorderImageWidthAuto = 0,
k_EBorderImageWidthNumber = 1,
k_EBorderImageWidthPercentage = 2
};
//-----------------------------------------------------------------------------
// Purpose: Transition timing functions
//-----------------------------------------------------------------------------
enum EAnimationTimingFunction
{
k_EAnimationNone = 0, // Indicates that there is no transition set, do not animate. Don't change from zero!
k_EAnimationEase,
k_EAnimationEaseIn,
k_EAnimationEaseOut,
k_EAnimationEaseInOut,
k_EAnimationLinear,
k_EAnimationCustomBezier,
k_EAnimationUnset,
// if you add another, update BParseTimingFunction()
};
//-----------------------------------------------------------------------------
// Purpose: Possible animation directions
//-----------------------------------------------------------------------------
enum EAnimationDirection
{
k_EAnimationDirectionUnset = 0,
k_EAnimationDirectionNormal,
k_EAnimationDirectionAlternate,
k_EAnimationDirectionReverse,
k_EAnimationDirectionAlternateReverse,
// if you add another, update BParseAnimationDirectionFunction()
};
//-----------------------------------------------------------------------------
// Purpose: Supported style psuedo classes
//-----------------------------------------------------------------------------
enum EStyleFlags : uint16
{
k_EStyleFlagNone = 0,
k_EStyleFlagHover = 1 << 0, // mouse is over the panel
k_EStyleFlagFocus = 1 << 1, // panel has keyboard focus
k_EStyleFlagActive = 1 << 2, // panel is being actively used (mouse-down on the panel)
k_EStyleFlagDisabled = 1 << 3, // panel is disabled
k_EStyleFlagInspect = 1 << 4, // panel is being inspected by the debugger
k_EStyleFlagSelected = 1 << 5, // panel is selected (button checked)
k_EStyleFlagDescendantFocused = 1 << 6, // a descendant of the panel has keyboard focus
k_EStyleFlagParentDisabled = 1 << 7, // a parent of this panel is disabled, thus implicitly disabling it
k_EStyleFlagLayoutLoading = 1 << 8, // panel is in-progress loading it's layout file and thus may want to display specially
k_EStyleFlagLayoutLoadFailed = 1 << 9, // panel failed to load requested layout file, and thus may want to display specially
k_EStyleFlagActivationDisabled = 1 << 10, // panel is disabled for activation, may still be enabled for focus (normal disabled disallows all input/focus)
};
//-----------------------------------------------------------------------------
// Purpose: Supported border styles
//-----------------------------------------------------------------------------
enum EBorderStyle
{
k_EBorderStyleUnset = -1,
k_EBorderStyleNone = 0,
k_EBorderStyleSolid = 1,
};
//-----------------------------------------------------------------------------
// Purpose: Horizontal alignments
//-----------------------------------------------------------------------------
enum EHorizontalAlignment
{
k_EHorizontalAlignmentUnset,
k_EHorizontalAlignmentLeft,
k_EHorizontalAlignmentCenter,
k_EHorizontalAlignmentRight
};
//-----------------------------------------------------------------------------
// Purpose: Vertical alignments
//-----------------------------------------------------------------------------
enum EVerticalAlignment
{
k_EVerticalAlignmentUnset,
k_EVerticalAlignmentTop,
k_EVerticalAlignmentCenter,
k_EVerticalAlignmentBottom
};
//-----------------------------------------------------------------------------
// Purpose: ContextUI (tooltips + context menus) position
//-----------------------------------------------------------------------------
enum EContextUIPosition
{
k_EContextUIPositionUnset,
k_EContextUIPositionLeft,
k_EContextUIPositionTop,
k_EContextUIPositionRight,
k_EContextUIPositionBottom,
};
//-----------------------------------------------------------------------------
// Purpose: Possible flow directions
//-----------------------------------------------------------------------------
enum EBackgroundRepeat
{
k_EBackgroundRepeatUnset,
k_EBackgroundRepeatRepeat,
k_EBackgroundRepeatSpace,
k_EBackgroundRepeatRound,
k_EBackgroundRepeatNo,
};
//-----------------------------------------------------------------------------
// Purpose: Special words for background sizes when not length or percentage
//-----------------------------------------------------------------------------
enum EBackgroundSizeConstant
{
k_EBackgroundSizeConstantNone,
k_EBackgroundSizeConstantContain,
k_EBackgroundSizeConstantCover
};
//-----------------------------------------------------------------------------
// Purpose: type of repaint to do for a render target/panel
//-----------------------------------------------------------------------------
enum EPanelRepaint : uint8
{
k_EPanelRepaintFull,
k_EPanelRepaintComposition,
k_EPanelRepaintNone
};
//-----------------------------------------------------------------------------
// Purpose: Specifies what category a sound is; each one of these maps to a volume control in the UI
//-----------------------------------------------------------------------------
enum ESoundType
{
k_ESoundType_Ambient, // ambient sounds, intro movie
k_ESoundType_Movies, // movies in store
k_ESoundType_Effects, // daisywheel, navigation
k_ESoundType_Passthrough, // special sound type for volume-changing UI - bypasses volume controls
};
//-----------------------------------------------------------------------------
// Purpose: Text Input handler types
//-----------------------------------------------------------------------------
enum ETextInputHandlerType_t
{
k_ETextInputHandlerType_DaisyWheel,
k_ETextInputHandlerType_DualTouch,
k_ETextInputHandlerTypeDefault = k_ETextInputHandlerType_DualTouch, // if we fail at gathering the information to figure out which is the most appropriate input method, fall back to this one
};
//-----------------------------------------------------------------------------
// Purpose: Possible flow directions
//-----------------------------------------------------------------------------
enum EFlowDirection : uint8
{
k_EFlowNone,
k_EFlowDown,
k_EFlowRight,
k_EFlowDownWrap,
k_EFlowRightWrap
};
//-----------------------------------------------------------------------------
// Purpose: Possible overflow settings
//-----------------------------------------------------------------------------
enum EOverflowValue : uint8
{
k_EOverflowSquish,
k_EOverflowClip,
k_EOverflowScroll,
k_EOverflowNoClip,
};
enum EMouseCanActivate : uint8
{
k_EMouseCanActivateUnfocused = 0,
k_EMouseCanActivateIfFocused,
k_EMouseCanActivateIfParentFocused,
k_EMouseCanActivateIfAnyParentFocused
};
// Focus navigation
enum EFocusMoveDirection
{
k_ENextInTabOrder = 1,
k_EPrevInTabOrder = 2,
k_ENextByXPosition = 4,
k_EPrevByXPosition = 8,
k_ENextByYPosition = 16,
k_EPrevByYPosition = 32
};
enum ELoadLayoutAsyncDetails
{
k_ELoadLayoutAsyncDetailsNone,
k_ELoadLayoutAsyncDetailsNotLoggedIn
};
enum EMixBlendMode
{
k_EMixBlendModeNormal,
k_EMixBlendModeMultiply,
k_EMixBlendModeScreen
};
enum ETextureSampleMode
{
k_ETextureSampleModeNormal,
k_ETextureSampleModeAlphaOnly,
};
//-----------------------------------------------------------------------------
// Purpose: Enum for the parts of layout a style invalidates when applied
//-----------------------------------------------------------------------------
enum EStyleInvalidateLayout
{
k_EStyleInvalidateLayoutNone,
k_EStyleInvalidateLayoutSizeAndPosition,
k_EStyleInvalidateLayoutPosition
};
enum EStyleRepaint
{
k_EStyleRepaintFull,
k_EStyleRepaintComposition,
k_EStyleRepaintNone,
};
enum EAntialiasing
{
k_EAntialiasingNone,
k_EAntialisingEnabled
};
enum EOverlayWindowAlignment
{
k_EOverlayWindowAlignment_FullscreenLetterboxed = 1,
k_EOverlayWindowAlignment_FullscreenNoLetterBox = 2,
k_EOverlayWindowAlignment_BottomRight = 3,
};
enum EStylePresentFlags : uint32
{
k_EStylePresentTransformMatrix = 1 << 0,
k_EStylePresentPerspective = 1 << 1,
k_EStylePresentPerspectiveOrigin = 1 << 2,
k_EStylePresentOpacity = 1 << 3,
k_EStylePresentWashColor = 1 << 4,
k_EStylePresentDesaturation = 1 << 5,
k_EStylePresentBlur = 1 << 6,
k_EStylePresentBorderRadius = 1 << 7,
k_EStylePresentOpacityMaskImage = 1 << 8,
k_EStylePresentBackgroundImage = 1 << 9,
k_EStylePresentBackgroundFillColor = 1 << 10,
k_EStylePresentBorder = 1 << 11,
k_EStylePresentBoxShadow = 1 << 12,
k_EStylePresentBorderImage = 1 << 13,
k_EStylePresentScale2DCentered = 1 << 14,
k_EStylePresentRotate2DCentered = 1 << 15,
k_EStylePresentTextShadow = 1 << 16,
k_EStylePresentClip = 1 << 17,
k_EStylePresentMixBlendMode = 1 << 18,
};
// constants, these must remain matching
const float k_flTabIndexInvalid = -1.0 * FLT_MAX;
const float k_flSelectionPosInvalid = k_flTabIndexInvalid;
const float k_flTabIndexAuto = FLT_MAX;
const float k_flSelectionPosAuto = k_flTabIndexAuto;
// These constants are duplicated in CSS files, so if you change them make sure to change the CSS values as well.
const double k_flScrollTransitionTime = 0.2;
const EAnimationTimingFunction k_flScrollTransitionFunc = k_EAnimationEaseInOut;
//-----------------------------------------------------------------------------
// Purpose: bit flags used to control panel construction behavior
//-----------------------------------------------------------------------------
enum EPanelFlags
{
ePanelFlags_DontAddAsChild = 0x1, // don't automatically add this panel as a child to its parent
ePanelFlags_DontFireOnLoad = 0x2, // don't fire the onload event when constructed, useful for image panel that waits until its contents load
};
enum EPanelEventSource_t
{
k_ePanelEventSourceProgram,
k_ePanelEventSourceGamepad,
k_ePanelEventSourceKeyboard,
k_ePanelEventSourceMouse,
k_ePanelEventSourceInvalid
};
class IUIPanel;
class IUIEvent;
typedef IUIEvent* (*PFN_ParseUIEvent)(panorama::IUIPanel *pTarget, const char *pchEvent, const char **pchEventEnd);
typedef IUIEvent* (*PFN_MakeUIEvent0)(const panorama::IUIPanelClient *pTarget);
typedef IUIEvent* (*PFN_MakeUIEvent1Source)(const panorama::IUIPanelClient *pTarget, EPanelEventSource_t eSource);
typedef IUIEvent* (*PFN_MakeUIEvent1Repeats)(const panorama::IUIPanelClient *pTarget, int nRepeats);
struct UIEventFactory
{
int m_cParams;
bool m_bPanelEvent;
PFN_ParseUIEvent m_pfnParseUIEvent;
PFN_MakeUIEvent0 m_pfnMakeUIEvent0;
PFN_MakeUIEvent1Repeats m_pfnMakeUIEvent1Repeats;
PFN_MakeUIEvent1Source m_pfnMakeUIEvent1Source;
};
//-----------------------------------------------------------------------------
// Simple refcounted base class that doesn't auto-delete when refs hit zero.
//-----------------------------------------------------------------------------
class CLayoutRefCounted
{
public:
CLayoutRefCounted()
{
m_nRefCount = 0;
}
int AddRef()
{
return ++m_nRefCount;
}
int Release()
{
int nResult = --m_nRefCount;
Assert( nResult >= 0 );
return nResult;
}
int GetRefCount() const
{
return m_nRefCount;
}
private:
int m_nRefCount;
};
//-----------------------------------------------------------------------------
// Pointer to a CLayoutRefCounted that owns a ref of the pointee
//-----------------------------------------------------------------------------
template< class T >
class CLayoutRefPtr
{
public:
CLayoutRefPtr() : m_pObject( NULL ) {}
CLayoutRefPtr( T *pFrom ) { Set( pFrom ); }
CLayoutRefPtr( const CLayoutRefPtr< T > &from ) { Set( from.m_pObject ); }
~CLayoutRefPtr()
{
if ( m_pObject )
{
m_pObject->Release();
}
}
void operator=( const CLayoutRefPtr<T> &from ) { Set( from.m_pObject ); }
operator const T *() const { return m_pObject; }
operator T *() { return m_pObject; }
operator bool() const { return ( m_pObject != NULL ); }
T *operator=( T *p ) { Set( p ); return p; }
bool operator!() const { return ( !m_pObject ); }
bool operator==( T *p ) const { return ( m_pObject == p ); }
bool operator!=( T *p ) const { return ( m_pObject != p ); }
bool operator==( const CLayoutRefPtr<T> &p ) const { return ( m_pObject == p.m_pObject ); }
bool operator!=( const CLayoutRefPtr<T> &p ) const { return ( m_pObject != p.m_pObject ); }
T * operator->() { return m_pObject; }
T & operator *() { return *m_pObject; }
T ** operator &() { return &m_pObject; }
const T * operator->() const { return m_pObject; }
const T & operator *() const { return *m_pObject; }
T * const * operator &() const { return &m_pObject; }
void Set( T *pObject )
{
if ( m_pObject )
{
m_pObject->Release();
}
m_pObject = pObject;
if ( pObject )
{
pObject->AddRef();
}
}
protected:
T *m_pObject;
};
enum EWindowFocusBehavior
{
// By default, controls in this window will take focus whenever they're interacted with.
k_EWindowFocusBehavior_Default,
// By default, clicking on controls in this window will avoid taking focus unless it's necessary.
// Useful if you only plan on supporting keyboard focus in a few specific spots and otherwise
// don't display keyboard focus.
k_EWindowFocusBehavior_Shy,
};
struct SteamPadPointer_t
{
bool bVisible;
Vector2D vecCenter;
float flRadius;
uint32 nTextureID;
int iControllerID;
float (* funcPreRenderCalculatePadOffset)( float, bool );
};
} // namespace panorama
#endif // PANORAMATYPES_H
|