Dillo v3.1.1-98-g318d1f14
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:
332 struct SpanSpace {
333 int startCol, startRow; // where the cell starts
334 };
335
336 struct Child
337 {
338 enum {
339 CELL, // cell starts here
340 SPAN_SPACE // part of a spanning cell
342 union {
343 struct Cell cell;
345 };
346 };
347
349 {
350 protected:
351 int numContentsInFlow ();
353
354 public:
355 TableIterator (Table *table, core::Content::Type mask, bool atEnd);
356
358
359 void highlight (int start, int end, core::HighlightLayer layer);
360 void unhighlight (int direction, core::HighlightLayer layer);
361 void getAllocation (int start, int end, core::Allocation *allocation);
362 };
363
364 friend class TableIterator;
365
367
369
372
374
379
390
401
406
418
420
422
424
425 const char *getExtrModName (ExtrMod mod);
427 void setExtreme (core::Extremes *extremes, ExtrMod mod, int value);
428 int getColExtreme (int col, ExtrMod mod, void *data);
429 inline void setColExtreme (int col, ExtrMod mod, void *data, int value);
430
431 inline bool childDefined(int n)
432 {
433 return n < children->size() && children->get(n) != NULL &&
434 children->get(n)->type != Child::SPAN_SPACE;
435 }
436
438
439 void reallocChildren (int newNumCols, int newNumRows);
440
441 void calcCellSizes (bool calcHeights);
442 void forceCalcCellSizes (bool calcHeights);
443 void actuallyCalcCellSizes (bool calcHeights);
444 void apportionRowSpan ();
445
447 void calcExtremesSpanMultiCols (int col, int cs,
448 core::Extremes *cellExtremes,
449 ExtrMod minExtrMod, ExtrMod maxExtrMod,
450 void *extrData);
451 void calcAdjustmentWidthSpanMultiCols (int col, int cs,
452 core::Extremes *cellExtremes);
453
454 void apportion2 (int totalWidth, int firstCol, int lastCol,
455 ExtrMod minExtrMod, ExtrMod maxExtrMod, void *extrData,
456 lout::misc::SimpleVector<int> *dest, int destOffset);
457
458 void setCumHeight (int row, int value)
459 {
460 if (value != cumHeight->get (row)) {
461 redrawY = lout::misc::min ( redrawY, value );
462 cumHeight->set (row, value);
463 }
464 }
465
466protected:
470 void resizeDrawImpl ();
471
473
474 int getAvailWidthOfChild (Widget *child, bool forceValue);
475
478 bool usesAvailWidth ();
479
480 bool isBlockLevel ();
481
482 void drawLevel (core::View *view, core::Rectangle *area, int level,
483 core::DrawingContext *context);
484
485 Widget *getWidgetAtPointLevel (int x, int y, int level,
487
488 //bool buttonPressImpl (core::EventButton *event);
489 //bool buttonReleaseImpl (core::EventButton *event);
490 //bool motionNotifyImpl (core::EventMotion *event);
491
492 void removeChild (Widget *child);
493
494public:
495 static int CLASS_ID;
496
499
500 inline static bool getAdjustTableMinWidth ()
502
503 Table(bool limitTextWidth);
504 ~Table();
505
506 int applyPerWidth (int containerWidth, core::style::Length perWidth);
507 int applyPerHeight (int containerHeight, core::style::Length perHeight);
508
509 core::Iterator *iterator (core::Content::Type mask, bool atEnd);
510
511 void addCell (Widget *widget, int colspan, int rowspan);
514};
515
516} // namespace dw
517
518#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:497
int getExtreme(core::Extremes *extremes, ExtrMod mod)
Definition table.cc:648
void setCumHeight(int row, int value)
Definition table.hh:458
~Table()
Definition table.cc:73
lout::misc::SimpleVector< core::style::Style * > * rowStyle
Definition table.hh:419
int calcAvailWidthForDescendant(Widget *child)
Definition table.cc:271
void calcAdjustmentWidthSpanMultiCols(int col, int cs, core::Extremes *cellExtremes)
Definition table.cc:1501
void apportionRowSpan()
Definition table.cc:1230
int getColExtreme(int col, ExtrMod mod, void *data)
Definition table.cc:701
lout::misc::SimpleVector< int > * baseline
Definition table.hh:417
void calcExtremesSpanMultiCols(int col, int cs, core::Extremes *cellExtremes, ExtrMod minExtrMod, ExtrMod maxExtrMod, void *extrData)
Definition table.cc:1450
void forceCalcColumnExtremes()
Fills dw::Table::colExtremes in all cases.
Definition table.cc:1295
void calcCellSizes(bool calcHeights)
Definition table.cc:824
void forceCalcCellSizes(bool calcHeights)
Definition table.cc:840
lout::misc::SimpleVector< int > * colWidths
The widths of all columns.
Definition table.hh:405
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:370
int redrawX
Definition table.hh:373
bool getAdjustMinWidth()
Definition table.hh:472
@ MIN_INTR
Definition table.hh:423
@ MAX_MIN
Definition table.hh:423
@ MIN_MIN
Definition table.hh:423
@ MAX_INTR
Definition table.hh:423
int curRow
Definition table.hh:370
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:370
lout::misc::SimpleVector< core::Extremes > * colExtremes
The extremes of all columns.
Definition table.hh:378
lout::misc::SimpleVector< int > * rowSpanCells
If a Cell has rowspan > 1, it goes into this array.
Definition table.hh:416
int curCol
Definition table.hh:370
lout::misc::SimpleVector< Child * > * children
Definition table.hh:371
void actuallyCalcCellSizes(bool calcHeights)
Definition table.cc:903
void sizeAllocateImpl(core::Allocation *allocation)
See Sizes of Dillo Widgets.
Definition table.cc:166
bool colWidthsUpToDateWidthColExtremes
Definition table.hh:421
bool limitTextWidth
Definition table.hh:368
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:400
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:500
lout::misc::SimpleVector< int > * cumHeight
Row cumulative height array: cumHeight->size() is numRows + 1, cumHeight->get(0) is 0,...
Definition table.hh:412
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:399
void reallocChildren(int newNumCols, int newNumRows)
Definition table.cc:724
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:1526
bool rowClosed
Definition table.hh:368
bool childDefined(int n)
Definition table.hh:431
int applyPerHeight(int containerHeight, core::style::Length perHeight)
Definition table.cc:325
int numColWidthSpecified
Definition table.hh:389
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:388
static bool adjustTableMinWidth
Definition table.hh:366
const char * getExtrModName(ExtrMod mod)
Definition table.cc:618
static int CLASS_ID
Definition table.hh:495
int redrawY
Definition table.hh:373
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:44
Allocation * getAllocation()
Definition widget.hh:484
Extremes extremes
Analogue to dw::core::Widget::requisition.
Definition widget.hh:166
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition widget.hh:204
Requisition requisition
Size_request() stores the result of the last call of size_request_impl().
Definition widget.hh:160
style::Style * style
Definition widget.hh:150
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:115
void set(int i, T t)
Store an object in the vector.
Definition misc.hh:267
T get(int i) const
Return the one element, explicitly.
Definition misc.hh:222
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:429
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:40
core::Widget * widget
Definition table.hh:329
struct SpanSpace spanSpace
Definition table.hh:344
struct Cell cell
Definition table.hh:343
enum dw::Table::Child::@22 type
Represents the allocation, i.e.
Definition types.hh:164