Class TMenuItemToggleFullScreen

Unit

Declaration

type TMenuItemToggleFullScreen = class(TMenuItemChecked)

Description

Menu item that toggles TCastleWindow.FullScreen.

This already has a nice caption, key shortcut (F11 on most platforms, except macOS where it's Command+F11 (on LCL backend) or Ctrl+F11 (on other backends), since the bare F11 is reserved on macOS). And it has a DoClick implementation that takes care of the actual job.

So you can just add it to your menu, and forget about it.

Source: window/castlewindowmenu.inc (line 472).

Hierarchy

Show Additional Members:

Overview

Methods

Protected procedure ClearHandles; virtual;
Public procedure MenuUpdateBegin;
Public procedure MenuUpdateEnd;
Public constructor Create(const ACaption: String);
Public function DoClick: boolean; virtual;
Public function KeyToString(out S: string): boolean;
Public function KeyMatches(const AKey: TKey; const AKeyString: String; const AModifiers: TModifierKeys): boolean;
Public function CaptionWithKey: string;
Public constructor Create(const ACaption: String; AIntData: Integer); overload;
Public constructor Create(const ACaption: String; AIntData: Integer; AKeyString: String); overload;
Public constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey); overload;
Public destructor Destroy; override;
Protected procedure SetChecked(Value: boolean); virtual;
Protected procedure DoAutoCheckedToggle; virtual;
Public function DoClick: boolean; override;
Public constructor Create(const ACaption: String; AIntData: Integer; AChecked, AAutoCheckedToggle: boolean); overload;
Public constructor Create(const ACaption: String; AIntData: Integer; const AKeyString: String; AChecked, AAutoCheckedToggle: boolean); overload;
Public constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey; AChecked, AAutoCheckedToggle: boolean); overload;
Public constructor Create(const InitialFullScreen: boolean);
Public function DoClick: boolean; override;

Properties

Public property ParentMenu: TMenu read FParentMenu;
Public property ParentMenuPosition: Cardinal read FParentMenuPosition;
Public property Caption: String read FCaption write SetCaption;
Public property Enabled: boolean read FEnabled write SetEnabled default true;
Public property IntData: Integer read FIntData write FIntData;
Public property SmallId: Integer read FSmallId;
Public property KeyString: String read FKeyString write FKeyString;
Public property Key: TKey read FKey write FKey default keyNone;
Public property CharKey: Char read GetCharKey write SetCharKey; deprecated 'use KeyString';
Public property Modifiers: TModifierKeys read FModifiers write FModifiers;
Public property Checked: boolean read FChecked write SetChecked;
Public property AutoCheckedToggle: boolean read FAutoCheckedToggle write FAutoCheckedToggle;

Description

Methods

Protected procedure ClearHandles; virtual;

Recursively clear TMenuEntry.Handle values.

Source: window/castlewindowmenu.inc (line 56).

Public procedure MenuUpdateBegin;

For optimization purposes, you may surround many menu changes inside MenuUpdateBegin + MenuUpdateEnd calls. Make sure window is not closed / opened between them.

Source: window/castlewindowmenu.inc (line 62).

Public procedure MenuUpdateEnd;

This item has no description.

Source: window/castlewindowmenu.inc (line 63).

Public constructor Create(const ACaption: String);

This item has no description.

Source: window/castlewindowmenu.inc (line 87).

Public function DoClick: boolean; virtual;

Called when this menu item will be choosen by user (by clicking, or pressing the matching key shortcut).

You can override this and return true if you handled the event. If this will return false, CastleWindow will call EventMenuClick (OnMenuClick).

When entering this method, current OpenGL context is set to the context of the window that the clicked menu belongs to.

Default implementation of this method in this class always returns false.

Source: window/castlewindowmenu.inc (line 234).

Public function KeyToString(out S: string): boolean;

Returns as S the string that describes key shortcut (KeyString, Key, Modifiers) and then returns true. If KeyString = '' and Key = keyNone then returns false and S is undefined.

Source: window/castlewindowmenu.inc (line 303).

Public function KeyMatches(const AKey: TKey; const AKeyString: String; const AModifiers: TModifierKeys): boolean;

This item has no description.

Source: window/castlewindowmenu.inc (line 305).

Public function CaptionWithKey: string;

Caption with optional key description (returned by KeyString) appended.

Source: window/castlewindowmenu.inc (line 310).

Public constructor Create(const ACaption: String; AIntData: Integer); overload;

This item has no description.

Source: window/castlewindowmenu.inc (line 312).

Public constructor Create(const ACaption: String; AIntData: Integer; AKeyString: String); overload;

This item has no description.

Source: window/castlewindowmenu.inc (line 313).

Public constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey); overload;

This item has no description.

Source: window/castlewindowmenu.inc (line 314).

Public destructor Destroy; override;

This item has no description.

Source: window/castlewindowmenu.inc (line 316).

Protected procedure SetChecked(Value: boolean); virtual;

Called when Checked property is assigned.

Source: window/castlewindowmenu.inc (line 333).

Protected procedure DoAutoCheckedToggle; virtual;

Called from DoClick when AutoCheckedToggle is True. It's supposed to actually implement the AutoCheckedToggle behavior.

Note that this is overriden ina a "dirty" way (i.e. not calling "inherited") in TMenuItemRadio descendant.

Source: window/castlewindowmenu.inc (line 340).

Public function DoClick: boolean; override;

Overriden to handle AutoCheckedToggle. In this class, DoClick still returns false (like in ancestor class).

Source: window/castlewindowmenu.inc (line 351).

Public constructor Create(const ACaption: String; AIntData: Integer; AChecked, AAutoCheckedToggle: boolean); overload;

This item has no description.

Source: window/castlewindowmenu.inc (line 353).

Public constructor Create(const ACaption: String; AIntData: Integer; const AKeyString: String; AChecked, AAutoCheckedToggle: boolean); overload;

This item has no description.

Source: window/castlewindowmenu.inc (line 355).

Public constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey; AChecked, AAutoCheckedToggle: boolean); overload;

This item has no description.

Source: window/castlewindowmenu.inc (line 357).

Public constructor Create(const InitialFullScreen: boolean);

This item has no description.

Source: window/castlewindowmenu.inc (line 473).

Public function DoClick: boolean; override;

This item has no description. Showing description inherited from TMenuItemChecked.DoClick.

Overriden to handle AutoCheckedToggle. In this class, DoClick still returns false (like in ancestor class).

Source: window/castlewindowmenu.inc (line 474).

Properties

Public property ParentMenu: TMenu read FParentMenu;

This is the parent TMenu that has this item in it's Entries list. Nil is there is not parent menu yet (e.g. because it's not assigned yet, or because this is the main menu).

Source: window/castlewindowmenu.inc (line 69).

Public property ParentMenuPosition: Cardinal read FParentMenuPosition;

Position on ParentMenu. Indexed from 0, so ParentMenu.Entries[ParentMenuPosition] should be always equal to Self (as long as ParentMenu <> Nil.

Source: window/castlewindowmenu.inc (line 74).

Public property Caption: String read FCaption write SetCaption;

Caption of this menu entry. Will be shown to user.

To indicate that some letter of a caption is a mnemonic for this menu item put '_' (underscore) char before this letter. Depending on CastleWindow-backend-dependent, mnemonics should allow user to easier activate this menu item with keyboard (e.g. Alt+mnemonic to dropdown item in MainMenu).

You can put two consecutive underscore chars in Caption to indicate that here Caption should display literally one underscore character.

(Convention to mark mnemonics with '_' is just copied from gtk, from gtk_label_new_with_mnemonic. So no, I didn't invent another new convention here.)

It is undefined what will happen if you put underscore chars before *two* or more letters in Caption. I.e. you can't define multiple mnemonics for one menu item. I.e. this will not crash your program, but results may be CastleWindow-backend-dependent.

Just like in GTK toolkit gtk_label_new_with_mnemonic and gtk_menu_item_new_with_mnemonic.

Source: window/castlewindowmenu.inc (line 113).

Public property Enabled: boolean read FEnabled write SetEnabled default true;

This item has no description.

Source: window/castlewindowmenu.inc (line 115).

Public property IntData: Integer read FIntData write FIntData;

An integer value, for any purpose you want. Useful to identify this item in TCastleWindow.OnMenuClick callback.

Source: window/castlewindowmenu.inc (line 207).

Public property SmallId: Integer read FSmallId;

Unique small identifier of this menu item. This is initialized at creation of this object, to be unique among all currently existing (created and not destroyed) TMenuItem instances.

The intention is that this SmallId should be the smallest possible value >= 0. So it's not something like PtrUInt(Self). This may be useful when you're constructing a menu using some API — you usually want to identify your menu item by some unique id and you want this id to be small (e.g. under WinAPI menu item's id must fit in 16 bit integer).

See also
MenuItemFromSmallId
Search for menu item with given SmallId.

Source: window/castlewindowmenu.inc (line 221).

Public property KeyString: String read FKeyString write FKeyString;

Key shortcut for this menu item.

When user presses indicated Key (if it's not keyNone) or KeyString (if it's not '') then DoClick will be called (which results in TCastleWindow.EventMenuClick, and TCastleWindow.OnMenuClick, if DoClick returns false).

Handling of menu key shortcuts is completely within the CastleWindow (usually, it's even done by the underlying backend like GTK or WinAPI). You will not get EventPress (OnPress) messages for keypresses that translate to menu clicks. Although TCastleWindow.Pressed.Keys will be still appropriately updated.

Note that Caption of this object should not contain description of Key or KeyString. The backend will automatically show the key description in an appropriate way.

You should use at most one of these properties, not both. So either use Key or KeyString, and leave the other one at default value (Key = keyNone, KeyString = '').

The KeyString values within range CtrlA..CtrlZ mean that user must press the given letter with Ctrl modfier. This rule includes some special chars like

The KeyString values above do not mean the backspace or tab or enter keys, they mean the combination of Ctrl key + respective letter. If you want to have backspace/tab/enter keys to activate the menu item, use Key = keyBackSpace, Key = keyTab or Key = keyEnter.

TODO: for now, this must be assigned before adding this menu item to parent (actually, before the parent menu is added to window MainMenu) to work reliably. Don't change this property afterwards. Usually, you will set this property by an argument to the constructor.

Source: window/castlewindowmenu.inc (line 277).

Public property Key: TKey read FKey write FKey default keyNone;

This item has no description.

Source: window/castlewindowmenu.inc (line 278).

Public property CharKey: Char read GetCharKey write SetCharKey; deprecated 'use KeyString';

Warning: this symbol is deprecated: use KeyString

This item has no description.

Source: window/castlewindowmenu.inc (line 282).

Public property Modifiers: TModifierKeys read FModifiers write FModifiers;

Modifiers (shift, ctrl and such) required to activate this menu item. These have to be pressed along with Key or KeyString.

Note that KeyString may already indicate some modifiers, if it's one of the CtrlA ... CtrlZ then the Ctrl key is required and if it's an uppercase letter then the Shift key is required. There's no need to include this modifier in this property then.

TODO: for now, this must be assigned before adding this menu item to parent (actually, before the parent menu is added to window MainMenu) to work reliably. Don't change this property afterwards.

Source: window/castlewindowmenu.inc (line 297).

Public property Checked: boolean read FChecked write SetChecked;

This item has no description.

Source: window/castlewindowmenu.inc (line 342).

Public property AutoCheckedToggle: boolean read FAutoCheckedToggle write FAutoCheckedToggle;

If True then each time user chooses this menu item, Checked is changed to not Checked.

Source: window/castlewindowmenu.inc (line 346).


Generated by PasDoc 0.17.0.snapshot.