add 'scroll' container property
This commit is contained in:
parent
a8067ad9d6
commit
2ee0605f1f
@ -60,7 +60,13 @@ Common element methods:
|
|||||||
|
|
||||||
## Containers
|
## Containers
|
||||||
|
|
||||||
Common methods for containers (elements: container, panel, button, pagebox):
|
Common properties for containers (elements: container, panel, button, pagebox):
|
||||||
|
|
||||||
|
| Name | Type | Read | Write | Description |
|
||||||
|
| ------ | ------ | ---- | ----- | --------------- |
|
||||||
|
| scroll | string | yes | yes | scroll contents |
|
||||||
|
|
||||||
|
Common methods:
|
||||||
|
|
||||||
| Method | Description |
|
| Method | Description |
|
||||||
| ------------------------------- | -------------------------------------------------------------------------------------------- |
|
| ------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||||
|
|||||||
@ -60,7 +60,13 @@ document["worlds-panel"]:clear()
|
|||||||
|
|
||||||
## Контейнеры
|
## Контейнеры
|
||||||
|
|
||||||
Общие для контейнеров методы (элементы: container, panel, button, pagebox):
|
Свойства, относящиеся к контейнерам (элементы: container, panel, button, pagebox):
|
||||||
|
|
||||||
|
| Название | Тип | Чтение | Запись | Описание |
|
||||||
|
| ------------- | ------ | ------ | ------ | ----------------------------------------- |
|
||||||
|
| scroll | string | да | да | прокрутка содержимого |
|
||||||
|
|
||||||
|
Методы:
|
||||||
|
|
||||||
| Метод | Описание |
|
| Метод | Описание |
|
||||||
| ------------------------------- | ------------------------------------------------------------------------------------------- |
|
| ------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||||
|
|||||||
@ -226,6 +226,10 @@ void Container::refresh() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Container::setScroll(int scroll) {
|
||||||
|
this->scroll = scroll;
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<std::shared_ptr<UINode>>& Container::getNodes() const {
|
const std::vector<std::shared_ptr<UINode>>& Container::getNodes() const {
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,6 +42,7 @@ namespace gui {
|
|||||||
virtual int getScrollStep() const;
|
virtual int getScrollStep() const;
|
||||||
virtual void setScrollStep(int step);
|
virtual void setScrollStep(int step);
|
||||||
virtual void refresh() override;
|
virtual void refresh() override;
|
||||||
|
void setScroll(int scroll);
|
||||||
|
|
||||||
virtual void mouseMove(GUI*, int x, int y) override;
|
virtual void mouseMove(GUI*, int x, int y) override;
|
||||||
virtual void mouseRelease(GUI*, int x, int y) override;
|
virtual void mouseRelease(GUI*, int x, int y) override;
|
||||||
|
|||||||
@ -423,6 +423,13 @@ static int p_get_cursor(UINode* node, lua::State* L) {
|
|||||||
return lua::pushstring(L, to_string(node->getCursor()));
|
return lua::pushstring(L, to_string(node->getCursor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int p_get_scroll(UINode* node, lua::State* L) {
|
||||||
|
if (auto container = dynamic_cast<Container*>(node)) {
|
||||||
|
return lua::pushnumber(L, container->getContentOffset().y);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int l_gui_getattr(lua::State* L) {
|
static int l_gui_getattr(lua::State* L) {
|
||||||
auto docname = lua::require_string(L, 1);
|
auto docname = lua::require_string(L, 1);
|
||||||
auto element = lua::require_string(L, 2);
|
auto element = lua::require_string(L, 2);
|
||||||
@ -469,6 +476,7 @@ static int l_gui_getattr(lua::State* L) {
|
|||||||
{"min", p_get_min},
|
{"min", p_get_min},
|
||||||
{"max", p_get_max},
|
{"max", p_get_max},
|
||||||
{"step", p_get_step},
|
{"step", p_get_step},
|
||||||
|
{"scroll", p_get_scroll},
|
||||||
{"trackWidth", p_get_track_width},
|
{"trackWidth", p_get_track_width},
|
||||||
{"trackColor", p_get_track_color},
|
{"trackColor", p_get_track_color},
|
||||||
{"textColor", p_get_text_color},
|
{"textColor", p_get_text_color},
|
||||||
@ -655,6 +663,13 @@ static void p_set_cursor(UINode* node, lua::State* L, int idx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int p_set_scroll(UINode* node, lua::State* L, int idx) {
|
||||||
|
if (auto container = dynamic_cast<Container*>(node)) {
|
||||||
|
container->setScroll(lua::tointeger(L, idx));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int l_gui_setattr(lua::State* L) {
|
static int l_gui_setattr(lua::State* L) {
|
||||||
auto docname = lua::require_string(L, 1);
|
auto docname = lua::require_string(L, 1);
|
||||||
auto element = lua::require_string(L, 2);
|
auto element = lua::require_string(L, 2);
|
||||||
@ -692,6 +707,7 @@ static int l_gui_setattr(lua::State* L) {
|
|||||||
{"min", p_set_min},
|
{"min", p_set_min},
|
||||||
{"max", p_set_max},
|
{"max", p_set_max},
|
||||||
{"step", p_set_step},
|
{"step", p_set_step},
|
||||||
|
{"scroll", p_set_scroll},
|
||||||
{"trackWidth", p_set_track_width},
|
{"trackWidth", p_set_track_width},
|
||||||
{"trackColor", p_set_track_color},
|
{"trackColor", p_set_track_color},
|
||||||
{"textColor", p_set_text_color},
|
{"textColor", p_set_text_color},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user