新增:单元格编辑完成回调;单击第一列选中整行
This commit is contained in:
@@ -159,6 +159,12 @@ namespace ezui {
|
||||
int m_lastClickRow = -1;
|
||||
int m_lastClickCol = -1;
|
||||
|
||||
// 选中行(非CheckBox模式下,通过单击第一列选中的行)
|
||||
int m_selectedRow = -1;
|
||||
|
||||
// 编辑前的原始值(用于编辑完成回调)
|
||||
UIString m_editOriginalValue;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
@@ -236,13 +242,17 @@ namespace ezui {
|
||||
virtual const Size& GetContentSize() override;
|
||||
|
||||
public:
|
||||
// 选中行背景色(当第一列为CheckBox且被选中时使用)
|
||||
// 选中行背景色(当第一列为CheckBox且被选中时使用,或者单击选中行时使用)
|
||||
Color SelectedRowBackColor = Color(0xFFADD8E6); // 浅蓝色
|
||||
|
||||
// 单元格内容变化回调
|
||||
// 单元格内容变化回调(内容变化时立即触发)
|
||||
// 参数: row, col, newValue
|
||||
std::function<void(int, int, const UIString&)> CellValueChanged = nullptr;
|
||||
|
||||
// 单元格编辑完成回调(编辑结束时触发,比如TextBox失去焦点或按Enter时)
|
||||
// 参数: row, col, oldValue, newValue
|
||||
std::function<void(int, int, const UIString&, const UIString&)> CellEditFinished = nullptr;
|
||||
|
||||
public:
|
||||
TableView(Object* parentObject = nullptr);
|
||||
virtual ~TableView();
|
||||
@@ -376,6 +386,15 @@ namespace ezui {
|
||||
// 获取所有选中的行索引
|
||||
std::vector<int> GetCheckedRows() const;
|
||||
|
||||
// 获取当前选中的行(非CheckBox模式,通过单击第一列选中)
|
||||
int GetSelectedRow() const;
|
||||
|
||||
// 设置当前选中的行(非CheckBox模式)
|
||||
void SetSelectedRow(int row);
|
||||
|
||||
// 清除选中行(非CheckBox模式)
|
||||
void ClearSelection();
|
||||
|
||||
// 全选
|
||||
void SelectAll();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user