00001 // This may look like C code, but it's really -*- C++ -*- 00002 /* 00003 * Copyright (C) 2006 Koen Deforche, Kessel-Lo, Belgium. 00004 * 00005 * See the LICENSE file for terms of use. 00006 */ 00007 00008 #ifndef ROUNDED_WIDGET_H_ 00009 #define ROUNDED_WIDGET_H_ 00010 00011 #include <WCompositeWidget> 00012 00013 #include "CornerImage.h" 00014 00015 namespace Wt { 00016 class WContainerWidget; 00017 } 00018 00023 00041 class RoundedWidget : public WCompositeWidget 00042 { 00043 public: 00046 enum Corner { TopLeft = CornerImage::TopLeft, 00047 TopRight = CornerImage::TopRight, 00048 BottomLeft = CornerImage::BottomLeft, 00049 BottomRight = CornerImage::BottomRight, 00050 All = 0xF}; 00051 00055 RoundedWidget(int corners = All, WContainerWidget *parent = 0); 00056 00059 ~RoundedWidget(); 00060 00067 void setBackgroundColor(WColor color); 00068 00071 WColor backgroundColor() const { return backgroundColor_; } 00072 00075 void setCornerRadius(int radius); 00076 00079 int cornerRadius() const { return radius_; } 00080 00086 void setSurroundingColor(WColor color); 00087 00090 WColor surroundingColor() const { return surroundingColor_; } 00091 00097 WContainerWidget *contents() const { return contents_; } 00098 00099 private: 00101 WColor backgroundColor_; 00102 00104 WColor surroundingColor_; 00105 00107 int radius_; 00108 00110 int corners_; 00111 00113 WContainerWidget *contents_; 00114 00116 WContainerWidget *impl_; 00117 00119 WContainerWidget *top_; 00120 00122 WContainerWidget *bottom_; 00123 00125 CornerImage *images_[4]; 00126 00128 void create(); 00129 00131 void adjust(); 00132 }; 00133 00136 #endif // ROUNDED_WIDGET_H_
1.4.7