1 /** 2 * File name: RkContainerWidgetItem.h 3 * Project: Redkite (A small GUI toolkit) 4 * 5 * Copyright (C) 2020 Iurie Nistor <http://iuriepage.wordpress.com> 6 * 7 * This file is part of Redkite. 8 * 9 * Redkite is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #ifndef RK_CONTAINER_WIDGET_ITEM_H 25 #define RK_CONTAINER_WIDGET_ITEM_H 26 27 #include <RkContainerItem.h> 28 29 class RkWidget; 30 31 class RK_EXPORT RkContainerWidgetItem: public RkContainerItem { 32 public: 33 RkContainerWidgetItem(RkWidget *parent, 34 Rk::Alignment align = Rk::Alignment::AlignLeft) RkContainerItem(parent,ItemType::ItemContainer,align)35 : RkContainerItem(parent, ItemType::ItemContainer, align) 36 , itemWidget{parent} {} 37 virtual ~RkContainerWidgetItem() = default; setPosition(const RkPoint & point)38 void setPosition(const RkPoint &point) override { itemWidget->setPosition(point); } position()39 RkPoint position() const override { return itemWidget->position(); } setX(int val)40 void setX(int val) override { itemWidget->setX(val); } x()41 int x() const override { return itemWidget->x(); } setY(int val)42 void setY(int val) override { itemWidget->setY(val); } y()43 int y() const override { return itemWidget->y(); } setSize(const RkSize & size)44 void setSize(const RkSize &size) override { itemWidget->setSize(size); } size()45 RkSize size() const override { return itemWidget->size(); } setWidth(int val)46 void setWidth(int val) override { itemWidget->setWidth(val); } width()47 int width() const override { return itemWidget->width(); } setHeight(int val)48 void setHeight(int val) override { itemWidget->setHeight(val); } height()49 int height() const override { return itemWidget->height(); } widget()50 RkWidget* widget() const { return itemWidget; } hide(bool b)51 void hide(bool b) override { return b ? itemWidget->hide() : itemWidget->show(); } isHidden()52 bool isHidden() const override { return !itemWidget->isShown(); } 53 54 private: 55 RK_DISABLE_COPY(RkContainerWidgetItem); 56 RK_DISABLE_MOVE(RkContainerWidgetItem); 57 RkSize itemSize; 58 RkWidget *itemWidget; 59 }; 60 61 #endif // RK_CONTAINER_WIDGET_ITEM_H 62