mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/code] Use TextFieldWithExtension in the list controller
This commit is contained in:
40
apps/code/script_name_cell.cpp
Normal file
40
apps/code/script_name_cell.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "script_name_cell.h"
|
||||
#include "app.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Code {
|
||||
|
||||
void ScriptNameCell::setEven(bool even) {
|
||||
EvenOddCell::setEven(even);
|
||||
m_textField.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void ScriptNameCell::setHighlighted(bool highlight) {
|
||||
EvenOddCell::setHighlighted(highlight);
|
||||
m_textField.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
const char * ScriptNameCell::text() const {
|
||||
if (!m_textField.isEditing()) {
|
||||
return m_textField.text();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
KDSize ScriptNameCell::minimalSizeForOptimalDisplay() const {
|
||||
return m_textField.minimalSizeForOptimalDisplay();
|
||||
}
|
||||
|
||||
void ScriptNameCell::didBecomeFirstResponder() {
|
||||
app()->setFirstResponder(&m_textField);
|
||||
}
|
||||
|
||||
void ScriptNameCell::layoutSubviews() {
|
||||
KDRect cellBounds = bounds();
|
||||
m_textField.setFrame(KDRect(cellBounds.x() + k_leftMargin,
|
||||
cellBounds.y(),
|
||||
cellBounds.width() - k_leftMargin,
|
||||
cellBounds.height()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user