1 /** 2 * File name: RkContainerItem.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_ITEM_H 25 #define RK_CONTAINER_ITEM_H 26 27 #include <RkWidget.h> 28 29 class RK_EXPORT RkContainerItem: public RkObject { 30 public: 31 enum class ItemType : int { 32 ItemContainer = 0, 33 ItemWidget = 1, 34 ItemSpace = 2, 35 }; 36 RkContainerItem(RkObject *parent = nullptr, 37 ItemType type = ItemType::ItemContainer, 38 Rk::Alignment align = Rk::Alignment::AlignLeft) RkObject(parent)39 : RkObject(parent) 40 , itemType{type} 41 , itemAlignment{align} 42 , itemHidden{false} {} 43 virtual ~RkContainerItem() = default; type()44 ItemType type() const { return itemType; } setPosition(const RkPoint & point)45 virtual void setPosition(const RkPoint &point) { itemPosition = point; } position()46 virtual RkPoint position() const { return itemPosition; } setX(int val)47 virtual void setX(int val) { itemPosition.setX(val); } x()48 virtual int x() const { return itemPosition.x(); } setY(int val)49 virtual void setY(int val) { itemPosition.setY(val); } y()50 virtual int y() const { return itemPosition.y(); } setSize(const RkSize & size)51 virtual void setSize(const RkSize &size) { itemSize = size; } size()52 virtual RkSize size() const { return itemSize; } setWidth(int val)53 virtual void setWidth(int val) { itemSize.setWidth(val); } width()54 virtual int width() const { return itemSize.width(); } setHeight(int val)55 virtual void setHeight(int val) { itemSize.setHeight(val); } height()56 virtual int height() const { return itemSize.height(); } setAlignment(Rk::Alignment align)57 void setAlignment(Rk::Alignment align) { itemAlignment = align; } alignment()58 Rk::Alignment alignment() const { return itemAlignment; } hide(bool b)59 virtual void hide(bool b) { itemHidden = b; } isHidden()60 virtual bool isHidden() const { return itemHidden; } 61 62 private: 63 RK_DISABLE_COPY(RkContainerItem); 64 RK_DISABLE_MOVE(RkContainerItem); 65 RkSize itemSize; 66 RkPoint itemPosition; 67 ItemType itemType; 68 Rk::Alignment itemAlignment; 69 bool itemHidden; 70 }; 71 72 #endif // RK_CONTAINER_ITEM_H 73