Dillo v3.1.1-14-g8f67d6e0
No Matches
dw::core::ui Namespace Reference

Anything related to embedded UI widgets is defined here. More...


class  ButtonResource
class  CheckButtonResource
class  ComplexButtonResource
class  Embed
 A widget for embedding UI widgets. More...
class  EntryResource
class  LabelButtonResource
 Interface for labelled buttons resources. More...
class  ListResource
class  MultiLineTextResource
class  OptionMenuResource
class  RadioButtonResource
class  Resource
 Basic interface for all resources. More...
class  ResourceFactory
 A factory for the common resource. More...
class  SelectionResource
 Base interface for dw::core::ui::ListResource and dw::core::ui::OptionMenuResource. More...
class  TextResource
class  ToggleButtonResource

Detailed Description

Anything related to embedded UI widgets is defined here.

UI resources are another abstraction for Dw widgets, which are not fully implemented in a platform-independent way. Typically, they involve creating widgets, which the underlying UI toolkit provides.

As you see in this diagram:


there are several levels:

  1. The Dw widget is dw::core::ui::Embed. It delegates most to dw::core::ui::Resource, which has similar methods like dw::core::Widget.

  2. There are several sub interfaces of dw::core::ui::Resource, which may provide methods, as e.g. dw::core::ui::ListResource::addItem. In a platform independent context, you can cast the result of dw::core::ui::Embed::getResource to a specific sub class, if you know, which one is used. E.g., if you know, that a given instance dw::core::ui::Embed refers to a dw::core::ui::ListResource, you can write something like:

    ((dw::core::ui::ListResource*)embed->getResource ())->addItem ("Hello!");
    A widget for embedding UI widgets.
    Definition ui.hh:224
    Resource * getResource()
    Definition ui.hh:263

  3. These sub classes are then fully implemented in a platform specific way. For an example, look at dw::fltk::ui.

There is a factory interface, dw::core::ui::ResourceFactory, which provides methods for creating common resources. By calling dw::core::Layout::getResourceFactory, which calls dw::core::Platform::getResourceFactory, you get the factory for the used platform.

It is possible to define additional sub classes of dw::core::ui::Resource, but since they are not provided by dw::core::ui::ResourceFactory, you have to define some other abstractions, if you want to remain platform independent.


Resouces needed for HTML

This chapter describes, how the form controls defined by HTML are implemented in Dw. Some of them do not refer to UI resources, but to other widgets, links to the respective documentations are provided here.

Resouces created with <INPUT>

The HTML <INPUT> is always implemented by using UI resources. <INPUT> element has the following attributes:

Attribute Implementation
type This defines the resource you have to instantiate.
name Not needed within Dw.
value The initial value is treated differently by different resources.
checked Parameter to dw::core::ui::ResourceFactory::createCheckButtonResource and dw::core::ui::ResourceFactory::createRadioButtonResource.
disabled This is provided for all resources by dw::core::ui::Resource::setEnabled.
readonly This is provided by dw::core::ui::TextResource::setEditable.
size This is handled by styles.
maxlength Parameter of dw::core::ui::ResourceFactory::createEntryResource.
src Handled by the caller (HTML parser).
alt Handled by the caller (HTML parser).
usemap Handled by the caller (HTML parser).
ismap Handled by the caller (HTML parser).
tabindex Not supported currently.
accesskey Not supported currently.
onfocus Not supported currently.
onblur Not supported currently.
onselect Not supported currently.
onchange Not supported currently.
accept Not supported currently.

For the different values of type, the following resources can be used:

Type Resource Factory Method
text dw::core::ui::EntryResource dw::core::ui::ResourceFactory::createEntryResource
password dw::core::ui::EntryResource dw::core::ui::ResourceFactory::createEntryResource
checkbox dw::core::ui::CheckButtonResource dw::core::ui::ResourceFactory::createCheckButtonResource
radio dw::core::ui::RadioButtonResource dw::core::ui::ResourceFactory::createRadioButtonResource
submit dw::core::ui::LabelButtonResource dw::core::ui::ResourceFactory::createLabelButtonResource
image dw::core::ui::ComplexButtonResource dw::core::ui::ResourceFactory::createComplexButtonResource, width a dw::Image inside and relief = false.
reset dw::core::ui::LabelButtonResource dw::core::ui::ResourceFactory::createLabelButtonResource
button dw::core::ui::LabelButtonResource dw::core::ui::ResourceFactory::createLabelButtonResource
hidden No rendering necessary. -
file Not supported currently. -


<SELECT> is implemented either by dw::core::ui::OptionMenuResource (better suitable for size = 1 and single selection) or dw::core::ui::ListResource, which have a common base, dw::core::ui::SelectionResource. In the latter case, size must be specified via dw::core::style::Style.

Factory methods are dw::core::ui::ResourceFactory::createListResource and dw::core::ui::ResourceFactory::createOptionMenuResource.

<OPTION>'s are added via dw::core::ui::SelectionResource::addItem.

<OPTGROUP> are created by using dw::core::ui::SelectionResource::pushGroup and dw::core::ui::SelectionResource::popGroup.

For lists, the selection mode must be set in dw::core::ui::ResourceFactory::createListResource.


<TEXTAREA> is implemented by dw::core::ui::MultiLineTextResource, the factory method is dw::core::ui::ResourceFactory::createMultiLineTextResource. dw::core::ui::TextResource::setEditable can be used, as for entries.


For handling <BUTTON>, dw::core::ui::ComplexButtonResource should be used, with a dw::Textblock inside, and relief = true. The contents of <BUTTON> is then added to the dw::Textblock.

describe activation signal