00001 /* 00002 libwt - Vassilis Virvilis Toolkit - a widget library 00003 Copyright (C) 2006 Vassilis Virvilis <vasvir2@fastmail.fm> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the 00017 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, SA. 00019 */ 00020 00021 #ifndef WT_CASCADE_H 00022 #define WT_CASCADE_H 00023 00024 #include <wt/frame.h> 00025 #include <wt/cascadelayout.h> 00026 00027 namespace Wt { 00028 00029 class Cascade : public Frame { 00030 public: 00031 Cascade(int hor_advance = 10, int ver_advance = 10, Widget *parent = 0, 00032 const std::string &name = "Cascade::anon", int wflags = 0) : 00033 Frame(parent, name, wflags) { 00034 new CascadeLayout(this, 0, hor_advance, ver_advance); 00035 layout()->autoAdd = true; 00036 } 00037 00038 void setAlignment(int alignment) { 00039 layout()->alignment = alignment; 00040 } 00041 00042 void setHorizontalAdvance(int dx) { 00043 cascadeLayout().horizontalAdvance = dx; 00044 } 00045 00046 void setVerticalAdvance(int dy) { 00047 cascadeLayout().verticalAdvance = dy; 00048 } 00049 00050 void pop() { 00051 LayoutItem *li = cascadeLayout().back(); 00052 if (li->is<Widget *>()) 00053 delete li; 00054 else 00055 cascadeLayout().removeItem(li); 00056 } 00057 00058 protected: 00059 CascadeLayout& cascadeLayout() const { 00060 return *dynamic_cast<CascadeLayout *>(layout()); 00061 } 00062 00063 private: 00064 }; 00065 00066 } 00067 00068 #endif // WT_CASCADE_H
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.