This file is indexed.

/usr/include/Wt/WGridLayout is in libwt-dev 3.1.10-1ubuntu2.

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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
// 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 WGRID_LAYOUT_H_
#define WGRID_LAYOUT_H_

#include <vector>
#include <Wt/WLayout>
#include <Wt/WLength>
#include <Wt/WGlobal>

namespace Wt {

  namespace Impl {

struct Grid {
  int horizontalSpacing_, verticalSpacing_;

  struct Row {
    int stretch_;
    bool resizable_;

    Row(int stretch = 0);
  };

  struct Column {
    int stretch_;
    bool resizable_;

    Column(int stretch = 0);
  };

  struct Item {
    WLayoutItem *item_;
    int rowSpan_;
    int colSpan_;
    WFlags<AlignmentFlag> alignment_;

    Item(WLayoutItem *item = 0, WFlags<AlignmentFlag> alignment = 0);
  };

  std::vector<Row>    rows_;
  std::vector<Column> columns_;
  std::vector<std::vector<Item> > items_; // [row][column]

  Grid();
  ~Grid();
};

  }

/*! \class WGridLayout Wt/WGridLayout Wt/WGridLayout
 *  \brief A layout manager which arranges widgets in a grid
 *
 * This is a layout class that arranges widgets in a grid, to span the
 * entire area of the parent container. Each grid location (row,
 * column) may contain one widget or nested layout. Horizontal and
 * vertical space are divided so that each column/row is given its
 * minimum size and the remaining space is dived according to stretch
 * factors among the columns/rows. The minimum width of a column/row
 * is based on the minimum dimensions of contained widgets or nested
 * layouts. The default minimum height and width may be overridden
 * using WWidget::setMinimumSize().
 *
 * If you want to use the layout manager for a container which does
 * not have a height that is constrained somehow, you need to specify
 * AlignTop in the alignment flags of
 * WContainerWidget::setLayout(). Otherwise the behavior is undefined
 * (the parent container will continue to increase in size as it tries
 * to satisfy the constraints assuming a contrained height).
 *
 * You can use \link WContainerWidget::setOverflow()
 * WContainerWidget::setOverflow(OverflowAuto) \endlink or use a
 * WScrollArea to automatically show scrollbars on a widget inserted
 * in the layout.
 *
 * A caveat with layout managers is that you cannot reliably use a
 * stylesheet to add borders (or margin) to a widget inserted in a
 * layout: this is broken on Internet Explorer. To provide the layout,
 * the layout manager needs to set sizes on the contained widget but
 * these sizes also need to take into account the border/margin
 * width. Since on IE, this value will be 0 if the border or margin is
 * provided by a stylesheet (as opposed to by inline CSS by using
 * WWidget::decorationStyle()), the result will be wrong behaviour
 * like widgets that keep growing in size.
 *
 * A layout manager may provide resize handles between columns or rows
 * which allow the user to change the automatic layout provided by the
 * layout manager (see setRowResizable() and
 * setColumnResizable()). Resize handles between rows only work when
 * the layout fills the parent vertical space (i.e. is not aligned to
 * the top). Likewise, resize handles between columns only work when
 * the layout fills the parent horiziontal space (i.e. is not aligned
 * left, right or centered).
 *
 * Columns and rows are separated using a constant spacing, which
 * defaults to 6 pixels by default, and can be changed using
 * setHorizontalSpacing() and setVerticalSpacing(). In addition, when
 * this layout is a top-level layout (i.e. is not nested inside
 * another layout), a margin is set around the contents, which thus
 * replaces padding defined for the container. It is not allowed to
 * define padding for the container widget using its CSS 'padding'
 * property or the WContainerWidget::setPadding(). This margin also
 * defaults to 9 pixels, and can be changed using
 * setContentsMargins().
 *
 * For each column or row, a stretch factor may be defined, which
 * controls how remaining horizontal or vertical space is used. Each
 * column and row is stretched using the stretch factor to fill the
 * remaining space. When the stretch factor is 0, the height of the row
 * and its contents is not actively managed. As a consequence, the contents
 * of each cell will not fill the cell. You may use a special stretch factor
 * of -1 to indicate that the height of the row should not stretch but the
 * contents height should be actively managed. This has as draw-back that
 * the height of the row will no longer reduce in size when any of the cell
 * contents reduces in size.
 *
 * Usage example:
 * \if cpp
 * \code
 * Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
 * w->resize(WLength::Auto, 600);
 *
 * Wt::WGridLayout *layout = new Wt::WGridLayout();
 * layout->addWidget(new Wt::WText("Item 0 0"), 0, 0);
 * layout->addWidget(new Wt::WText("Item 0 1"), 0, 1);
 * layout->addWidget(new Wt::WText("Item 1 0"), 1, 0);
 * layout->addWidget(new Wt::WText("Item 1 1"), 1, 1);
 *
 * w->setLayout(layout);
 * \endcode
 * \elseif java
 * \code
 * WContainerWidget w = new WContainerWidget(this);
 * w.resize(WLength.Auto, new WLength(600));
 *		 
 * WGridLayout layout = new WGridLayout();
 * layout.addWidget(new WText("Item 0 0"), 0, 0);
 * layout.addWidget(new WText("Item 0 1"), 0, 1);
 * layout.addWidget(new WText("Item 1 0"), 1, 0);
 * layout.addWidget(new WText("Item 1 1"), 1, 1);
 *		 
 * w.setLayout(layout);
 * \endcode
 * \endif
 *
 * \if cpp
 * \note This layout manager is applicable only to WContainerWidget
 * container widgets. You may use it within an Ext::Container
 * indirectly by first setting a WContainerWidget using a WFitLayout.
 * \endif
 *
 * \note When JavaScript support is not available, only Safari and
 * Firefox properly implement this layout. For other browsers, only
 * the horizontal layout is properly implemented, while vertically all
 * widgets use their minimum size.
 *
 * \note When set on a WContainerWidget, this layout manager accepts the
 *       following hints (see setLayoutHint()):
 *   <ul>
 *     <li>"table-layout" with possible values "auto" (default) or "fixed".<br>
 *       Use "fixed" to prevent nested tables from overflowing the layout.
 *       In that case, you will need to specify a width (in CSS or otherwise)
 *       for at least one item in every column that has no stretch factor.</li>
 *  </ul>
 */
class WT_API WGridLayout : public WLayout
{
public:
  /*! \brief Create a new grid layout.
   *
   * The grid will grow dynamically as items are added.
   *
   * Use \p parent = \c 0 to create a layout manager that can be
   * nested inside other layout managers or to specify a specific alignment
   * when setting the layout to a WContainerWidget.
   */
  WGridLayout(WWidget *parent = 0);

  virtual void addItem(WLayoutItem *item);
  virtual void removeItem(WLayoutItem *item);
  virtual WLayoutItem *itemAt(int index) const;
  virtual int count() const;

  /*! \brief Adds a layout item to the grid.
   *
   * Adds the <i>item</i> at (<i>row</i>, \p column). If an item
   * was already added to that location, it is replaced (but not
   * deleted).
   *
   * An item may span several more rows or columns, which is
   * controlled by <i>rowSpan</i> and \p columnSpan.
   *
   * The \p alignment specifies the vertical and horizontal
   * alignment of the item. The default value 0 indicates that the
   * item is stretched to fill the entire grid cell. The alignment can
   * be specified as a logical combination of a horizontal alignment
   * (Wt::AlignLeft, Wt::AlignCenter, or Wt::AlignRight) and a
   * vertical alignment (Wt::AlignTop, Wt::AlignMiddle, or
   * Wt::AlignBottom).
   *
   * \sa addLayout(), addWidget() 
   */
  void addItem(WLayoutItem *item, int row, int column,
	       int rowSpan = 1, int columnSpan = 1,
	       WFlags<AlignmentFlag> alignment = 0);

  /*! \brief Adds a nested layout item to the grid.
   *
   * Adds the <i>layout</i> at (<i>row</i>, \p column). If an item
   * was already added to that location, it is replaced (but not
   * deleted).
   *
   * The \p alignment specifies the vertical and horizontal
   * alignment of the item. The default value 0 indicates that the
   * item is stretched to fill the entire grid cell. The alignment can
   * be specified as a logical combination of a horizontal alignment
   * (Wt::AlignLeft, Wt::AlignCenter, or Wt::AlignRight) and a
   * vertical alignment (Wt::AlignTop, Wt::AlignMiddle, or
   * Wt::AlignBottom).
   *
   * \sa addLayout(WLayout *, int, int, int, int, WFlags<AlignmentFlag>) 
   */
  void addLayout(WLayout *layout, int row, int column,
		 WFlags<AlignmentFlag> alignment = 0);

  /*! \brief Adds a nested layout item to the grid.
   *
   * Adds the <i>layout</i> at (<i>row</i>, \p column). If an item
   * was already added to that location, it is replaced (but not
   * deleted).
   *
   * An item may span several more rows or columns, which is
   * controlled by <i>rowSpan</i> and \p columnSpan.
   *
   * The \p alignment specifies the vertical and horizontal
   * alignment of the item. The default value 0 indicates that the
   * item is stretched to fill the entire grid cell. The alignment can
   * be specified as a logical combination of a horizontal alignment
   * (Wt::AlignLeft, Wt::AlignCenter, or Wt::AlignRight) and a
   * vertical alignment (Wt::AlignTop, Wt::AlignMiddle, or
   * Wt::AlignBottom).
   *
   * \sa addLayout(WLayout *, int, int, WFlags<AlignmentFlag>) 
   */
  void addLayout(WLayout *layout, int row, int column,
		 int rowSpan, int columnSpan,
		 WFlags<AlignmentFlag> alignment = 0);

  /*! \brief Adds a widget to the grid.
   *
   * Adds the <i>widget</i> at (<i>row</i>, \p column). If an item
   * was already added to that location, it is replaced (but not
   * deleted).
   *
   * The \p alignment specifies the vertical and horizontal
   * alignment of the item. The default value 0 indicates that the
   * item is stretched to fill the entire grid cell. The alignment can
   * be specified as a logical combination of a horizontal alignment
   * (Wt::AlignLeft, Wt::AlignCenter, or Wt::AlignRight) and a
   * vertical alignment (Wt::AlignTop, Wt::AlignMiddle, or
   * Wt::AlignBottom).
   *
   * \sa addWidget(WWidget *, int, int, int, int, WFlags<AlignmentFlag>) 
   */
  void addWidget(WWidget *widget, int row, int column,
		 WFlags<AlignmentFlag> alignment = 0);

  /*! \brief Adds a widget to the grid.
   *
   * Adds the <i>widget</i> at (<i>row</i>, \p column). If an item
   * was already added to that location, it is replaced (but not
   * deleted).
   *
   * The widget may span several more rows or columns, which is
   * controlled by <i>rowSpan</i> and \p columnSpan.
   *
   * The \p alignment specifies the vertical and horizontal
   * alignment of the item. The default value 0 indicates that the
   * item is stretched to fill the entire grid cell. The alignment can
   * be specified as a logical combination of a horizontal alignment
   * (Wt::AlignLeft, Wt::AlignCenter, or Wt::AlignRight) and a
   * vertical alignment (Wt::AlignTop, Wt::AlignMiddle, or
   * Wt::AlignBottom).
   *
   * \sa addWidget(WWidget *, int, int, WFlags<AlignmentFlag>)
   */
  void addWidget(WWidget *widget, int row, int column,
		 int rowSpan, int columnSpan,
		 WFlags<AlignmentFlag> alignment = 0);

  /*! \brief Sets the horizontal spacing.
   *
   * The default horizontal spacing is 9 pixels.
   *
   * \sa setVerticalSpacing(int) 
   */
  void setHorizontalSpacing(int size);

  /*! \brief Returns the horizontal spacing.
   *
   * \sa setHorizontalSpacing(int) 
   */
  int horizontalSpacing() const { return grid_.horizontalSpacing_; }

  /*! \brief Sets the vertical spacing.
   *
   * The default vertical spacing is 9 pixels.
   *
   * \sa setHorizontalSpacing(int) 
   */
  void setVerticalSpacing(int size);

  /*! \brief Returns the vertical spacing.
   *
   * \sa setVerticalSpacing(int) 
   */
  int verticalSpacing() const { return grid_.verticalSpacing_; }

  /*! \brief Returns the column count.
   *
   * The grid dimensions change dynamically when adding contents to
   * the grid.
   *
   * \sa rowCount()
   */
  int columnCount() const;

  /*! \brief Returns the row count.
   *
   * The grid dimensions change dynamically when adding contents to
   * the grid.
   *
   * \sa columnCount()
   */
  int rowCount() const;

  /*! \brief Sets the column stretch.
   *
   * Sets the <i>stretch</i> factor for column \p column.
   *
   * \sa columnStretch()
   */
  void setColumnStretch(int column, int stretch);

  /*! \brief Returns the column stretch.
   *
   * \sa setColumnStretch(int, int)
   */
  int columnStretch(int column) const;

  /*! \brief Sets the row stretch.
   *
   * Sets the <i>stretch</i> factor for row \p row. See the
   * description for the special value of -1.
   *
   * \sa rowStretch()
   */
  void setRowStretch(int row, int stretch);

  /*! \brief Returns the column stretch.
   *
   * \sa setRowStretch(int, int)
   */
  int rowStretch(int row) const;

  /*! \brief Sets whether the user may drag a particular column border.
   *
   * This method sets whether the border that separates column
   * <i>column</i> from the next column may be resized by the user,
   * depending on the value of <i>enabled</i>.
   *
   * The default value is <i>false</i>.
   */
  void setColumnResizable(int column, bool enabled = true);

  /*! \brief Returns whether the user may drag a particular column border.
   *
   * This method returns whether the border that separates column
   * <i>column</i> from the next column may be resized by the user.
   *
   * \sa setColumnResizable()
   */
  bool columnIsResizable(int column) const;

  /*! \brief Sets whether the user may drag a particular row border.
   *
   * This method sets whether the border that separates row <i>row</i> from
   * the next row may be resized by the user, depending on the value of
   * <i>enabled</i>.
   *
   * The default value is <i>false</i>.
   */
  void setRowResizable(int row, bool enabled = true);

  /*! \brief Returns whether the user may drag a particular row border.
   *
   * This method returns whether the border that separates row
   * <i>row</i> from the next row may be resized by the user.
   *
   * \sa setRowResizable()
   */
  bool rowIsResizable(int row) const;

  Impl::Grid& grid() { return grid_; }

private:
  Impl::Grid grid_;

  void expand(int row, int column, int rowSpan, int columnSpan);
};

}

#endif // WGRID_LAYOUT_H_