Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
MenuBar
繼承: Control < CanvasItem < Node < Object
A horizontal menu bar that creates a menu for each PopupMenu child.
說明
A horizontal menu bar that creates a menu for each PopupMenu child. New items are created by adding PopupMenus to this node. Item title is determined by Window.title, or node name if Window.title is empty. Item title can be overridden using set_menu_title().
屬性
|
||
focus_mode |
|
|
|
||
|
||
|
||
|
||
|
方法
get_menu_count() const |
|
get_menu_popup(menu: int) const |
|
get_menu_title(menu: int) const |
|
get_menu_tooltip(menu: int) const |
|
is_menu_disabled(menu: int) const |
|
is_menu_hidden(menu: int) const |
|
is_native_menu() const |
|
void |
set_disable_shortcuts(disabled: bool) |
void |
set_menu_disabled(menu: int, disabled: bool) |
void |
set_menu_hidden(menu: int, hidden: bool) |
void |
set_menu_title(menu: int, title: String) |
void |
set_menu_tooltip(menu: int, tooltip: String) |
主題屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
屬性說明
扁平的 MenuBar,不顯示專案裝飾。
Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead.
bool prefer_global_menu = true 🔗
If true, MenuBar will use system global menu when supported.
Note: If true and global menu is supported, this node is not displayed, has zero size, and all its child nodes except PopupMenus are inaccessible.
Note: This property overrides the value of the PopupMenu.prefer_native_menu property of the child nodes.
Position order in the global menu to insert MenuBar items at. All menu items in the MenuBar are always inserted as a continuous range. Menus with lower start_index are inserted first. Menus with start_index equal to -1 are inserted last.
如果為 true,當游標懸停在功能表專案上方時,將關閉目前的 PopupMenu 並打開另一個。
TextDirection text_direction = 0 🔗
void set_text_direction(value: TextDirection)
TextDirection get_text_direction()
基礎文字書寫方向。
方法說明
返回功能表專案的數量。
PopupMenu get_menu_popup(menu: int) const 🔗
返回與功能表專案關聯的 PopupMenu。
String get_menu_title(menu: int) const 🔗
返回功能表專案的標題。
String get_menu_tooltip(menu: int) const 🔗
返回功能表專案的工具提示。
bool is_menu_disabled(menu: int) const 🔗
Returns true if the menu item is disabled.
bool is_menu_hidden(menu: int) const 🔗
Returns true if the menu item is hidden.
Returns true if the current system's global menu is supported and used by this MenuBar.
void set_disable_shortcuts(disabled: bool) 🔗
如果為 true,快捷方式將被禁用,無法用於觸發按鈕。
void set_menu_disabled(menu: int, disabled: bool) 🔗
為 true 時,功能表專案為禁用狀態。
void set_menu_hidden(menu: int, hidden: bool) 🔗
為 true 時,功能表專案為隱藏狀態。
void set_menu_title(menu: int, title: String) 🔗
設定功能表專案的標題。
void set_menu_tooltip(menu: int, tooltip: String) 🔗
設定功能表專案的工具提示。
主題屬性說明
Color font_color = Color(0.875, 0.875, 0.875, 1) 🔗
功能表專案的預設文字 Color。
Color font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) 🔗
功能表專案處於禁用狀態時使用的文字 Color。
Color font_focus_color = Color(0.95, 0.95, 0.95, 1) 🔗
功能表專案處於聚焦狀態時使用的文字 Color。只替換按鈕的正常文字顏色。禁用、懸停和按下狀態優先於這個顏色。
Color font_hover_color = Color(0.95, 0.95, 0.95, 1) 🔗
功能表專案處於懸停狀態時使用的文字 Color。
Color font_hover_pressed_color = Color(1, 1, 1, 1) 🔗
功能表專案處於懸停且按下狀態時使用的文字 Color。
Color font_outline_color = Color(0, 0, 0, 1) 🔗
功能表專案文字輪廓的色調。
Color font_pressed_color = Color(1, 1, 1, 1) 🔗
功能表專案處於按下狀態時使用的文字 Color。
功能表專案之間的水平距離。
文字輪廓的大小。
注意:如果使用啟用了 FontFile.multichannel_signed_distance_field 的字形,其 FontFile.msdf_pixel_range 必須至少設定為 outline_size 的兩倍,輪廓算繪才能看起來正確。否則,輪廓可能會比預期的更早被切斷。
功能表專案文字的字形 Font。
功能表專案文字的字形大小。
功能表專案處於禁用狀態時使用的 StyleBox。
該 OptionButton 處於禁用狀態時使用的 StyleBox(用於從右至左佈局)。
功能表專案處於懸停狀態時使用的 StyleBox。
該 OptionButton 處於懸停狀態時使用的 StyleBox(用於從右至左佈局)。
功能表專案處於按下狀態時使用的 StyleBox。
StyleBox hover_pressed_mirrored 🔗
該 OptionButton 處於按下狀態時使用的 StyleBox(用於從右至左佈局)。
功能表專案的預設 StyleBox。
該 OptionButton 的預設 StyleBox(用於從右至左佈局)。
功能表專案處於按下狀態時使用的 StyleBox。
該 OptionButton 處於按下狀態時使用的 StyleBox(用於從右至左佈局)。