Dillo v3.1.1-11-g8f0909b7
Loading...
Searching...
No Matches
table.hh
Go to the documentation of this file.
1#ifndef __DW_TABLE_HH__
2#define __DW_TABLE_HH__
3
4#include "oofawarewidget.hh"
5#include "alignedtablecell.hh"
6#include "../lout/misc.hh"
7
8namespace dw {
9
326{
327private:
328 struct Child
329 {
330 enum {
331 CELL, // cell starts here
332 SPAN_SPACE // part of a spanning cell
334 union {
335 struct {
339 struct {
340 int startCol, startRow; // where the cell starts
342 };
343 };
344
346 {
347 protected:
348 int numContentsInFlow ();
350
351 public:
352 TableIterator (Table *table, core::Content::Type mask, bool atEnd);
353
355
356 void highlight (int start, int end, core::HighlightLayer layer);
357 void unhighlight (int direction, core::HighlightLayer layer);
358 void getAllocation (int start, int end, core::Allocation *allocation);
359 };
360
361 friend class TableIterator;
362
364
366
369
371
376
387
398
403
415
417
419
421
422 const char *getExtrModName (ExtrMod mod);
424 void setExtreme (core::Extremes *extremes, ExtrMod mod, int value);
425 int getColExtreme (int col, ExtrMod mod, void *data);
426 inline void setColExtreme (int col, ExtrMod mod, void *data, int value);
427
428 inline bool childDefined(int n)
429 {
430 return n < children->size() && children->get(n) != NULL &&
431 children->get(n)->type != Child::SPAN_SPACE;
432 }
433
435
436 void reallocChildren (int newNumCols, int newNumRows);
437
438 void calcCellSizes (bool calcHeights);
439 void forceCalcCellSizes (bool calcHeights);
440 void actuallyCalcCellSizes (bool calcHeights);
441 void apportionRowSpan ();
442
444 void calcExtremesSpanMultiCols (int col, int cs,
445 core::Extremes *cellExtremes,
446 ExtrMod minExtrMod, ExtrMod maxExtrMod,
447 void *extrData);
448 void calcAdjustmentWidthSpanMultiCols (int col, int cs,
449 core::Extremes *cellExtremes);
450
451 void apportion2 (int totalWidth, int firstCol, int lastCol,
452 ExtrMod minExtrMod, ExtrMod maxExtrMod, void *extrData,
453 lout::misc::SimpleVector<int> *dest, int destOffset);
454
455 void setCumHeight (int row, int value)
456 {
457 if (value != cumHeight->get (row)) {
458 redrawY = lout::misc::min ( redrawY, value );
459 cumHeight->set (row, value);
460 }
461 }
462
463protected:
467 void resizeDrawImpl ();
468
470
471 int getAvailWidthOfChild (Widget *child, bool forceValue);
472
475 bool usesAvailWidth ();
476
477 bool isBlockLevel ();
478
479 void drawLevel (core::View *view, core::Rectangle *area, int level,
480 core::DrawingContext *context);
481
482 Widget *getWidgetAtPointLevel (int x, int y, int level,
484
485 //bool buttonPressImpl (core::EventButton *event);
486 //bool buttonReleaseImpl (core::EventButton *event);
487 //bool motionNotifyImpl (core::EventMotion *event);
488
489 void removeChild (Widget *child);
490
491public:
492 static int CLASS_ID;
493
496
497 inline static bool getAdjustTableMinWidth ()
499
500 Table(bool limitTextWidth);
501 ~Table();
502
503 int applyPerWidth (int containerWidth, core::style::Length perWidth);
504 int applyPerHeight (int containerHeight, core::style::Length perHeight);
505
506 core::Iterator *iterator (core::Content::Type mask, bool atEnd);
507
508 void addCell (Widget *widget, int colspan, int rowspan);
511};
512
513} // namespace dw
514
515#endif // __DW_TABLE_HH__
void unhighlight(int direction, core::HighlightLayer layer)
Shrink highlighted region to no longer contain the current content.
void highlight(int start, int end, core::HighlightLayer layer)
Extend highlighted region to contain part of the current content.
lout::object::Object * clone()
Return an exact copy of the object.
void getContentInFlow(int index, core::Content *content)
A Widget for rendering tables.
Definition table.hh:326
AlignedTableCell * getCellRef()
Definition table.cc:602
void drawLevel(core::View *view, core::Rectangle *area, int level, core::DrawingContext *context)
Definition table.cc:379
static void setAdjustTableMinWidth(bool adjustTableMinWidth)
Definition table.hh:494
int getExtreme(core::Extremes *extremes, ExtrMod mod)
Definition table.cc:648
void setCumHeight(int row, int value)
Definition table.hh:455
~Table()
Definition table.cc:73
lout::misc::SimpleVector< core::style::Style * > * rowStyle
Definition table.hh:416
int calcAvailWidthForDescendant(Widget *child)
Definition table.cc:271
void calcAdjustmentWidthSpanMultiCols(int col, int cs, core::Extremes *cellExtremes)
Definition table.cc:1497
void apportionRowSpan()
Definition table.cc:1226
int getColExtreme(int col, ExtrMod mod, void *data)
Definition table.cc:701
lout::misc::SimpleVector< int > * baseline
Definition table.hh:414
void calcExtremesSpanMultiCols(int col, int cs, core::Extremes *cellExtremes, ExtrMod minExtrMod, ExtrMod maxExtrMod, void *extrData)
Definition table.cc:1446
void forceCalcColumnExtremes()
Fills dw::Table::colExtremes in all cases.
Definition table.cc:1291
void calcCellSizes(bool calcHeights)
Definition table.cc:823
void forceCalcCellSizes(bool calcHeights)
Definition table.cc:839
lout::misc::SimpleVector< int > * colWidths
The widths of all columns.
Definition table.hh:402
int applyPerWidth(int containerWidth, core::style::Length perWidth)
Definition table.cc:320
int getAvailWidthOfChild(Widget *child, bool forceValue)
Definition table.cc:225
void resizeDrawImpl()
Called after sizeAllocateImpl() to redraw necessary areas.
Definition table.cc:217
bool affectsSizeChangeContainerChild(Widget *child)
Definition table.cc:347
void addCell(Widget *widget, int colspan, int rowspan)
Definition table.cc:468
void getExtremesSimpl(core::Extremes *extremes)
Simple variant, to be implemented by widgets with extremes not depending on positions.
Definition table.cc:133
int numCols
Definition table.hh:367
int redrawX
Definition table.hh:370
bool getAdjustMinWidth()
Definition table.hh:469
@ MIN_INTR
Definition table.hh:420
@ MAX_MIN
Definition table.hh:420
@ MIN_MIN
Definition table.hh:420
@ MAX_INTR
Definition table.hh:420
int curRow
Definition table.hh:367
void containerSizeChangedForChildren()
Definition table.cc:330
void addRow(core::style::Style *style)
Definition table.cc:584
bool usesAvailWidth()
Must be implemengted by a method returning true, when getAvailWidth() is called.
Definition table.cc:369
bool isBlockLevel()
Definition table.cc:374
int numRows
Definition table.hh:367
lout::misc::SimpleVector< core::Extremes > * colExtremes
The extremes of all columns.
Definition table.hh:375
lout::misc::SimpleVector< int > * rowSpanCells
If a Cell has rowspan > 1, it goes into this array.
Definition table.hh:413
int curCol
Definition table.hh:367
lout::misc::SimpleVector< Child * > * children
Definition table.hh:368
void actuallyCalcCellSizes(bool calcHeights)
Definition table.cc:902
void sizeAllocateImpl(core::Allocation *allocation)
See Sizes of Dillo Widgets.
Definition table.cc:166
bool colWidthsUpToDateWidthColExtremes
Definition table.hh:418
bool limitTextWidth
Definition table.hh:365
void sizeRequestSimpl(core::Requisition *requisition)
Simple variant, to be implemented by widgets with sizes not depending on positions.
Definition table.cc:106
void removeChild(Widget *child)
Definition table.cc:458
int numColWidthPercentage
Definition table.hh:397
core::Iterator * iterator(core::Content::Type mask, bool atEnd)
Return an iterator for this widget.
Definition table.cc:463
void setColExtreme(int col, ExtrMod mod, void *data, int value)
Definition table.cc:712
static bool getAdjustTableMinWidth()
Definition table.hh:497
lout::misc::SimpleVector< int > * cumHeight
Row cumulative height array: cumHeight->size() is numRows + 1, cumHeight->get(0) is 0,...
Definition table.hh:409
void setExtreme(core::Extremes *extremes, ExtrMod mod, int value)
Definition table.cc:675
lout::misc::SimpleVector< bool > * colWidthPercentage
Wether the column itself (in the future?) or at least one cell in this column or spanning over this c...
Definition table.hh:396
void reallocChildren(int newNumCols, int newNumRows)
Definition table.cc:723
void apportion2(int totalWidth, int firstCol, int lastCol, ExtrMod minExtrMod, ExtrMod maxExtrMod, void *extrData, lout::misc::SimpleVector< int > *dest, int destOffset)
Actual apportionment function.
Definition table.cc:1522
bool rowClosed
Definition table.hh:365
bool childDefined(int n)
Definition table.hh:428
int applyPerHeight(int containerHeight, core::style::Length perHeight)
Definition table.cc:325
int numColWidthSpecified
Definition table.hh:386
Widget * getWidgetAtPointLevel(int x, int y, int level, core::GettingWidgetAtPointContext *context)
Definition table.cc:425
lout::misc::SimpleVector< bool > * colWidthSpecified
Wether the column itself (in the future?) or at least one cell in this column or spanning over this c...
Definition table.hh:385
static bool adjustTableMinWidth
Definition table.hh:363
const char * getExtrModName(ExtrMod mod)
Definition table.cc:618
static int CLASS_ID
Definition table.hh:492
int redrawY
Definition table.hh:370
Set at the top when drawing.
Definition types.hh:295
Set at the top when getting the widget at the point.
Definition types.hh:313
Iterators are used to iterate through the contents of a widget.
Definition iterator.hh:20
Content::Type mask
Definition iterator.hh:30
dw::core::Shape implemtation for simple rectangles.
Definition types.hh:70
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
The base class of all dillo widgets.
Definition widget.hh:24
Allocation * getAllocation()
Definition widget.hh:450
Extremes extremes
Analogue to dw::core::Widget::requisition.
Definition widget.hh:146
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition widget.hh:183
Requisition requisition
Size_request() stores the result of the last call of size_request_impl().
Definition widget.hh:140
style::Style * style
Definition widget.hh:130
Base class for widgets which can act as container and generator for widgets out of flow.
Simple (simpler than container::untyped::Vector and container::typed::Vector) template based vector.
Definition misc.hh:94
void set(int i, T t)
Store an object in the vector.
Definition misc.hh:246
T get(int i) const
Return the one element, explicitly.
Definition misc.hh:201
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:25
int Length
Type for representing all lengths within dw::core::style.
Definition style.hh:428
HighlightLayer
Definition types.hh:43
Dw is in this namespace, or sub namespaces of this one.
T min(T a, T b)
Definition misc.hh:19
struct dw::Table::Child::@23::@25 cell
enum dw::Table::Child::@22 type
struct dw::Table::Child::@23::@26 spanSpace
core::Widget * widget
Definition table.hh:336
Represents the allocation, i.e.
Definition types.hh:164