new_editor: unify shared UI text measurement semantics
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Foundation/UIEditorTextMeasurement.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstddef>
|
||||
@@ -16,7 +18,8 @@ struct UIEditorMenuBarItem {
|
||||
std::string menuId = {};
|
||||
std::string label = {};
|
||||
bool enabled = true;
|
||||
float desiredLabelWidth = 0.0f;
|
||||
// Pure measured label width. Button padding is applied only in layout.
|
||||
float measuredLabelWidth = 0.0f;
|
||||
};
|
||||
|
||||
struct UIEditorMenuBarState {
|
||||
@@ -81,6 +84,11 @@ struct UIEditorMenuBarHitTarget {
|
||||
std::size_t index = UIEditorMenuBarInvalidIndex;
|
||||
};
|
||||
|
||||
float ResolveUIEditorMenuBarMeasuredLabelWidth(
|
||||
const UIEditorMenuBarItem& item,
|
||||
const UIEditorMenuBarMetrics& metrics = {},
|
||||
const UIEditorTextMeasurer* textMeasurer = nullptr);
|
||||
|
||||
float ResolveUIEditorMenuBarDesiredButtonWidth(
|
||||
const UIEditorMenuBarItem& item,
|
||||
const UIEditorMenuBarMetrics& metrics = {});
|
||||
|
||||
Reference in New Issue
Block a user