dillo  3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java).
  Fossies Dox: dillo-3.0.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

listitem.cc
Go to the documentation of this file.
1 /*
2  * Dillo Widget
3  *
4  * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 
22 #include "listitem.hh"
23 #include "../lout/debug.hh"
24 #include <stdio.h>
25 
26 namespace dw {
27 
28 int ListItem::CLASS_ID = -1;
29 
30 ListItem::ListItem (ListItem *ref, bool limitTextWidth):
31  AlignedTextblock (limitTextWidth)
32 {
33  DBG_OBJ_CREATE ("dw::ListItem");
34  registerName ("dw::ListItem", &CLASS_ID);
35  setRefTextblock (ref);
36 }
37 
39 {
40  DBG_OBJ_DELETE ();
41 }
42 
44  core::style::Style *style)
45 {
46  hasListitemValue = true;
47  addWidget (widget, style);
48  addSpace (style);
50  updateValue ();
51 }
52 
53 void ListItem::initWithText (const char *text, core::style::Style *style)
54 {
55  hasListitemValue = true;
56  addText (text, style);
57  addSpace (style);
59  updateValue ();
60 }
61 
63 {
64  if (words->size () == 0)
65  return 0;
66  else
67  return words->getRef(0)->size.width + words->getRef(0)->origSpace;
68 }
69 
70 void ListItem::setMaxValue (int maxValue, int value)
71 {
72  innerPadding = maxValue;
73  line1Offset = - value;
74  redrawY = 0;
75  queueResize (0, true);
76 }
77 
78 } // namespace dw
DBG_OBJ_DELETE
#define DBG_OBJ_DELETE()
Definition: debug.hh:176
dw::AlignedTextblock
Base widget for all textblocks (sub classes of dw::Textblock), which are positioned vertically and al...
Definition: alignedtextblock.hh:13
dw::AlignedTextblock::setRefTextblock
void setRefTextblock(AlignedTextblock *ref)
Definition: alignedtextblock.cc:70
dw::Textblock::hasListitemValue
bool hasListitemValue
Definition: textblock.hh:433
DBG_OBJ_CREATE
#define DBG_OBJ_CREATE(klass)
Definition: debug.hh:175
dw::ListItem::initWithText
void initWithText(const char *text, core::style::Style *style)
Definition: listitem.cc:53
dw::Textblock::addSpace
void addSpace(core::style::Style *style)
Definition: textblock.cc:2024
dw::AlignedTextblock::updateValue
void updateValue()
Definition: alignedtextblock.cc:87
dw::core::style::StyleAttrs::listStylePosition
ListStylePosition listStylePosition
Definition: style.hh:517
dw::core::style::LIST_STYLE_POSITION_OUTSIDE
Definition: style.hh:297
dw::Textblock::innerPadding
int innerPadding
Definition: textblock.hh:435
dw::ListItem::setMaxValue
void setMaxValue(int maxValue, int value)
Definition: listitem.cc:70
dw::core::Widget::style
style::Style * style
Definition: widget.hh:104
dw::Textblock::line1Offset
int line1Offset
Definition: textblock.hh:437
dw::ListItem::getValue
int getValue()
Definition: listitem.cc:62
listitem.hh
dw::ListItem::initWithWidget
void initWithWidget(core::Widget *widget, core::style::Style *style)
Definition: listitem.cc:43
dw::ListItem::ListItem
ListItem(ListItem *ref, bool limitTextWidth)
Definition: listitem.cc:30
dw::ListItem
Definition: listitem.hh:9
dw::Textblock::addWidget
void addWidget(core::Widget *widget, core::style::Style *style)
Definition: textblock.cc:1945
dw::ListItem::CLASS_ID
static int CLASS_ID
Definition: listitem.hh:16
dw::Textblock::words
lout::misc::NotSoSimpleVector< Word > * words
Definition: textblock.hh:487
lout::identity::IdentifiableObject::registerName
void registerName(const char *className, int *classId)
This method must be called in the constructor for the sub class. See class comment for details.
Definition: identity.cc:67
dw::ListItem::~ListItem
~ListItem()
Definition: listitem.cc:38
dw::Textblock::redrawY
int redrawY
Definition: textblock.hh:476
dw::core::Widget
The base class of all dillo widgets.
Definition: widget.hh:23
dw::core::Widget::queueResize
void queueResize(int ref, bool extremesChanged)
This method should be called, when a widget changes its size.
Definition: widget.cc:171
dw
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtextblock.cc:26
dw::core::style::Style
Definition: style.hh:571
dw::Textblock::addText
void addText(const char *text, size_t len, core::style::Style *style)
Definition: textblock.cc:1676