添加ComboBox的xml实现

This commit is contained in:
睿 安
2026-01-29 09:45:03 +08:00
parent 415d9ab518
commit 0811c0eabb
19 changed files with 123 additions and 11 deletions

View File

@@ -32,6 +32,7 @@ namespace ezui {
VListView m_list;
int m_index = -1;
int m_pendingIndex = -1; // 延迟设置的索引用于XML属性解析
void Init();
protected:
virtual void OnLayout()override;
@@ -47,5 +48,7 @@ namespace ezui {
//添加一个item并返回新item的下标
int AddItem(const UIString& text);
void RemoveItem(int index);
//设置属性
virtual void SetAttribute(const UIString& key, const UIString& value)override;
};
};

View File

@@ -255,14 +255,29 @@ namespace ezui {
// 选中行背景色当第一列为CheckBox且被选中时使用或者单击选中行时使用
Color SelectedRowBackColor = Color(0xFFADD8E6); // 浅蓝色
/*
table->CellValueChanged = [](int row, int col, const UIString& value) {
// 处理内容变化
};
*/
// 单元格内容变化回调(内容变化时立即触发)
// 参数: row, col, newValue
std::function<void(int, int, const UIString&)> CellValueChanged = nullptr;
/*
table->CellEditFinished = [](int row, int col, const UIString& oldValue, const UIString& newValue) {
// 处理内容变化
};
*/
// 单元格编辑完成回调编辑结束时触发比如TextBox失去焦点或按Enter时
// 参数: row, col, oldValue, newValue
std::function<void(int, int, const UIString&, const UIString&)> CellEditFinished = nullptr;
/*
tableView->RightClick= [tableView](int row, int col) {
// 处理内容变化
};
*/
// 鼠标右键单击回调
// 参数: row, col (row=-1 表示点击在表头col=-1 表示点击在第一列)
std::function<void(int, int)> RightClick = nullptr;