Class TMenuAccessory
Unit
CastleOnScreenMenu
Declaration
type TMenuAccessory = class(TObject)
Description
Attachment to a specific menu item of TCastleOnScreenMenu, for example may store a value associated with given menu option, and allow to change it by a slider.
Hierarchy
Overview
Methods
Properties
 |
property OwnedByParent: boolean
read FOwnedByParent write FOwnedByParent default true; |
Description
Methods
 |
constructor Create; |
|
 |
function GetWidth: Integer; virtual; abstract; |
Return the width you will need to display yourself.
Note that this will be asked only from FixItemsRectangles from TCastleOnScreenMenu. So for example TMenuArgument is *not* supposed to return here something based on current TMenuArgument.Value, because we will not query GetWidth after every change of TMenuArgument.Value. Instead, TMenuArgument should return here the width of widest possible Value.
|
 |
procedure Draw(const Rectangle: TRectangle); virtual; abstract; |
Draw (2D) contents. Note that Rectangle.Width is for sure the same as you returned in GetWidth.
|
 |
function KeyDown(Key: TKey; C: char; ParentMenu: TCastleOnScreenMenu): boolean; virtual; |
This will be called if user will press a key when currently selected item has this TMenuAccessory.
You can use ParentMenu to call ParentMenu.AccessoryValueChanged.
|
 |
function MouseDown(const Event: TInputPressRelease; const Rectangle: TRectangle; ParentMenu: TCastleOnScreenMenu): boolean; virtual; |
Called when user clicks the mouse when currently selected item has this TMenuAccessory.
Called only if Event.MousePosition is within current Rectangle (place on screen) of this accessory. This Rectangle is also passed here, so you can e.g. calculate mouse position relative to current accessory as (Event.Position[0] - Rectangle.Left, Event.Position[1] - Rectangle.Bottom).
Note that while the user holds the mouse clicked (Event.Pressed <> []), the mouse is "grabbed" by this accessory, and even when the user will move the mouse over other items, they will not receive their MouseDown /Motion messages until user will let the mouse go. This prevents the bad situation when user does MouseDown e.g. on "Sound Volume" slider, slides it to the right and then accidentaly moves the mouse also a little down, and suddenly he's over "Music Volume" slider and he changed the position of "Music Volume" slider.
You can use ParentMenu to call ParentMenu.AccessoryValueChanged.
|
 |
procedure Motion(const Event: TInputMotion; const Rectangle: TRectangle; ParentMenu: TCastleOnScreenMenu); virtual; |
Called when user moves the mouse over the currently selected menu item and menu item has this accessory.
Just like with MouseDown: This will be called only if Event.Position is within appropriate Rectangle of accessory. You can use ParentMenu to call ParentMenu.AccessoryValueChanged.
|
Properties
 |
property OwnedByParent: boolean
read FOwnedByParent write FOwnedByParent default true; |
Should this accessory be freed when TCastleOnScreenMenu using it is freed. Useful to set this to False when you want to share one TMenuAccessory across more than one TCastleOnScreenMenu.
|
Generated by PasDoc 0.13.0 on 2014-10-26 05:15:13
|