/usr/lib/Wt/examples/style/RoundedWidget.h is in witty-examples 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef ROUNDED_WIDGET_H_
#define ROUNDED_WIDGET_H_
#include <Wt/WCompositeWidget>
#include "CornerImage.h"
namespace Wt {
class WContainerWidget;
}
/**
* @addtogroup styleexample
*/
/*@{*/
/*! \brief A widget with rounded corners.
*
* This widgets represents a widget for which any combination of its four
* corners may be rounded. Although rounded corners is not a standard part
* of the CSS specification, this widget will be rendered identical on
* all platforms.
*
* The contents of the widget is managed inside a WContainerWidget, which
* is accessed using the contents() method.
*
* The radius of the rounded corners, the background color of the image,
* and the surrounding color may be changed at all times.
*
* The RoundedWidget is part of the %Wt style example.
*
* \sa CornerImage.
*/
class RoundedWidget : public WCompositeWidget
{
public:
/*! \brief One of the four corners of a widget.
*/
enum Corner { TopLeft = CornerImage::TopLeft, //!< Top left
TopRight = CornerImage::TopRight, //!< Top right
BottomLeft = CornerImage::BottomLeft, //!< Bottom left
BottomRight = CornerImage::BottomRight, //!< Bottom right
All = 0xF}; //!< All
/*! \brief Construct a widget with any combination of its corners
* rounded.
*/
RoundedWidget(int corners = All, WContainerWidget *parent = 0);
/*! \brief Destruct a RoundedWidget
*/
~RoundedWidget();
/*! \brief Set the widget background color.
*
* Because the background color also affects the color of the
* corner images, the background color cannot be set using the
* WCssDecorationStyle() of the widget.
*/
void setBackgroundColor(WColor color);
/*! \brief Get the widget background color.
*/
WColor backgroundColor() const { return backgroundColor_; }
/*! \brief Show or hide rounded corners.
*/
void enableRoundedCorners(bool how);
/*! \brief Set the corner radius of the widget.
*/
void setCornerRadius(int radius);
/*! \brief Get the corner radius of the widget.
*/
int cornerRadius() const { return radius_; }
/*! \brief Set the surrounding color of the widget.
*
* This color will be used "outside" the corner, in each of the
* corner images.
*/
void setSurroundingColor(WColor color);
/*! \brief Get the surrounding color of the widget.
*/
WColor surroundingColor() const { return surroundingColor_; }
/*! \brief Access the contents container.
*
* The contents WContainerWidget represents the contents inside
* the rounded widget.
*/
WContainerWidget *contents() const { return contents_; }
private:
//! Background color
WColor backgroundColor_;
//! "Surrounding" color -- maybe we can use a transparent color ?
WColor surroundingColor_;
//! Radius
int radius_;
//! OR'ed specification of the corners which are to be rounded.
int corners_;
//! The container widget in which to store the contents.
WContainerWidget *contents_;
//! This composite widget is implemented as a WContainerWidget
WContainerWidget *impl_;
//! A container at the top which renders the top rounding
WContainerWidget *top_;
//! A container at the bottom renders the bottom rounding
WContainerWidget *bottom_;
//! Up to four CornerImages for each corner.
CornerImage *images_[4];
//! Create the implementation.
void create();
//! Adjust the image (colors and radius).
void adjust();
};
/*@}*/
#endif // ROUNDED_WIDGET_H_
|