/usr/include/Wt/Chart/WAxisSliderWidget is in libwt-dev 3.3.6+dfsg-1.1.
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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2015 Emweb bvba, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef CHART_WAXIS_SLIDER_WIDGET_H_
#define CHART_WAXIS_SLIDER_WIDGET_H_
#include <Wt/WBrush>
#include <Wt/WJavaScriptHandle>
#include <Wt/WPaintedWidget>
#include <Wt/WPen>
#include <Wt/WRectF>
namespace Wt {
class WRectF;
namespace Chart {
class WDataSeries;
/*! \class WAxisSliderWidget Wt/Chart/WAxisSliderWidget Wt/Chart/WAxisSliderWidget
* \brief A widget for selecting an X axis range to display on an associated WCartesianChart.
*
* \note This widget currently only works with the HtmlCanvas rendering method.
*
* \ingroup charts
*/
class WT_API WAxisSliderWidget : public WPaintedWidget {
public:
/*! \brief Creates an axis slider widget.
*
* Creates an axis slider widget that is not associated with a chart.
* Before it is used, a chart should be assigned with setChart(),
* and a series column chosen with setSeriesColumn().
*/
WAxisSliderWidget(WContainerWidget *parent = 0);
/*! \brief Creates an axis slider widget.
*
* Creates an axis slider widget associated with the given data series
* of the given chart.
*/
WAxisSliderWidget(WDataSeries *series, WContainerWidget *parent = 0);
/*! \brief Destructor
*/
virtual ~WAxisSliderWidget();
void setSeries(WDataSeries *series);
/*! \brief Set the pen to draw the data series with.
*/
void setSeriesPen(const WPen& pen);
/*! \brief Returns the pen to draw the data series with.
*/
const WPen& seriesPen() const { return seriesPen_; }
/*! \brief Set the pen to draw the selected part of the data series with.
*
* If not set, this defaults to seriesPen().
*/
void setSelectedSeriesPen(const WPen& pen);
/*! \brief Returns the pen to draw the selected part of the data series with.
*/
WPen selectedSeriesPen() const { return *selectedSeriesPen_; }
/*! \brief Set the brush to draw the handles left and right of the selected area with.
*/
void setHandleBrush(const WBrush& brush);
/*! \brief Returns the brush to draw the handles left and right of the selected area with.
*/
const WBrush& handleBrush() const { return handleBrush_; }
/*! \brief Set the background brush.
*/
void setBackground(const WBrush& background);
/*! \brief Returns the background brush.
*/
const WBrush& background() const { return background_; }
/*! \brief Set the brush for the selected area.
*/
void setSelectedAreaBrush(const WBrush& brush);
/*! \brief Returns the brush for the selected area.
*/
const WBrush& selectedAreaBrush() const { return selectedAreaBrush_; }
/*! \brief Sets an internal margin for the selection area.
*
* This configures the area (in pixels) around the selection area that
* is available for the axes and labels, and the handles.
*
* Alternatively, you can configure the chart layout to be computed automatically using setAutoLayoutEnabled().
*
* \sa setAutoLayoutEnabled()
*/
void setSelectionAreaPadding(int padding, WFlags<Side> sides = All);
/*! \brief Returns the internal margin for the selection area.
*
* This is either the padding set through setSelectionAreaPadding() or computed using setAutoLayoutEnabled().
*
* \sa setPlotAreaPadding()
*/
int selectionAreaPadding(Side side) const;
/*! \brief Configures the axis slider layout to be automatic.
*
* This configures the selection area so that the space around it is suited for the text that is rendered.
*/
void setAutoLayoutEnabled(bool enabled = true);
/*! \brief Returns whether chart layout is computed automatically.
*
* \sa setAutoLayoutEnabled()
*/
bool isAutoLayoutEnabled() const { return autoPadding_; }
/*! \brief Set whether to draw the X axis tick labels on the slider widget.
*
* Labels are enabled by default.
*/
void setLabelsEnabled(bool enabled = true);
/*! \brief Returns whether the X axis tick labels are drawn.
*
* \sa setLabelsEnabled()
*/
bool isLabelsEnabled() const { return labelsEnabled_; }
/*! \brief Set whether the Y axis of the associated chart should be updated to fit the series.
*
* Y axis zoom is enabled by default.
*/
void setYAxisZoomEnabled(bool enabled = true);
/*! \brief Returns whether the Y axis of the associated chart should be updated to fit the series.
*
* \sa setYAxisZoomEnabled()
*/
bool isYAxisZoomEnabled() const { return yAxisZoomEnabled_; }
WDataSeries *series() { return series_; }
const WDataSeries *series() const { return series_; }
protected:
virtual void render(WFlags<RenderFlag> flags) WT_CXX11ONLY(override) ;
virtual void paintEvent(WPaintDevice *paintDevice) WT_CXX11ONLY(override) ;
private:
void init();
std::string sObjJsRef() const;
WRectF hv(const WRectF& rect) const;
WTransform hv(const WTransform& t) const;
WCartesianChart *chart();
const WCartesianChart *chart() const;
WDataSeries *series_;
WPen seriesPen_;
WPen *selectedSeriesPen_;
WBrush handleBrush_;
WBrush background_;
WBrush selectedAreaBrush_;
bool autoPadding_;
bool labelsEnabled_;
bool yAxisZoomEnabled_;
int padding_[4];
WJavaScriptHandle<WTransform> transform_;
};
}
}
#endif // CHART_WAXIS_SLIDER_WIDGET_H_
|