Add support for altering the border thickness of objects and add a 'frame' object as a visual representation of a group.
This commit is contained in:
parent
8ddf716d8c
commit
48f45296ce
2 changed files with 25 additions and 5 deletions
|
@ -80,6 +80,11 @@ a simple, "hello world" dialog:
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>50</y>
|
<y>50</y>
|
||||||
<label>Hello, world</label>
|
<label>Hello, world</label>
|
||||||
|
<color>
|
||||||
|
<red>1.0</red>
|
||||||
|
<green>0.0</green>
|
||||||
|
<blue>0.0</blue>
|
||||||
|
</color>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<button>
|
<button>
|
||||||
|
@ -117,6 +122,8 @@ properties, though they will ignore any that are not relevant:
|
||||||
height - the height of the object, in pseudo-pixels. The default is
|
height - the height of the object, in pseudo-pixels. The default is
|
||||||
the width of the parent container.
|
the width of the parent container.
|
||||||
|
|
||||||
|
border - the border thickness, in pseudo-pixels. The default is 2.
|
||||||
|
|
||||||
color - a subgroup to specify the dialogs color:
|
color - a subgroup to specify the dialogs color:
|
||||||
red - specify the red color component of the color scheme.
|
red - specify the red color component of the color scheme.
|
||||||
green - specify the green color component of the color scheme.
|
green - specify the green color component of the color scheme.
|
||||||
|
@ -126,7 +133,7 @@ properties, though they will ignore any that are not relevant:
|
||||||
font - a subgroup to specify a specific font type
|
font - a subgroup to specify a specific font type
|
||||||
name - the name of the font (excluding it's .txf extension)
|
name - the name of the font (excluding it's .txf extension)
|
||||||
size - size of the font
|
size - size of the font
|
||||||
slant - the slant of the font (in pixels)
|
slant - the slant of the font (in pseudo-pixels)
|
||||||
|
|
||||||
legend - the text legend to display in the object.
|
legend - the text legend to display in the object.
|
||||||
|
|
||||||
|
@ -142,8 +149,8 @@ properties, though they will ignore any that are not relevant:
|
||||||
presses the [RETURN] key.
|
presses the [RETURN] key.
|
||||||
|
|
||||||
Objects may appear nested within the top-level dialog or a "group"
|
Objects may appear nested within the top-level dialog or a "group"
|
||||||
object. Here are all the object types allowed, with their special
|
or a "frame" object. Here are all the object types allowed, with their
|
||||||
properties:
|
special properties:
|
||||||
|
|
||||||
|
|
||||||
dialog
|
dialog
|
||||||
|
@ -180,14 +187,17 @@ Example:
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
||||||
|
|
||||||
group
|
group and frame
|
||||||
-----
|
---------------
|
||||||
|
|
||||||
A group of subobjects. This object does not draw anything on the
|
A group of subobjects. This object does not draw anything on the
|
||||||
screen, but all of its children specify their coordinates relative to
|
screen, but all of its children specify their coordinates relative to
|
||||||
the group; using groups makes it easy to move parts of a dialog
|
the group; using groups makes it easy to move parts of a dialog
|
||||||
around.
|
around.
|
||||||
|
|
||||||
|
A frame is a visual representation of a group and has a border and an
|
||||||
|
adjustable background color.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
|
|
|
@ -427,6 +427,13 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
|
||||||
puGroup * group = new puGroup(x, y);
|
puGroup * group = new puGroup(x, y);
|
||||||
setupGroup(group, props, width, height, color, false);
|
setupGroup(group, props, width, height, color, false);
|
||||||
return group;
|
return group;
|
||||||
|
} else if (type == "frame") {
|
||||||
|
puFrame * frame = new puFrame(x, y, width, height);
|
||||||
|
frame->setBorderThickness(1);
|
||||||
|
frame->setColorScheme(color[0], color[1], color[2], color[3]);
|
||||||
|
puGroup * group = new puGroup(x, y);
|
||||||
|
setupGroup(group, props, width, height, color, false);
|
||||||
|
return group;
|
||||||
} else if (type == "list") {
|
} else if (type == "list") {
|
||||||
puList * list = new puList(x, y, x + width, y + height);
|
puList * list = new puList(x, y, x + width, y + height);
|
||||||
setupObject(list, props);
|
setupObject(list, props);
|
||||||
|
@ -554,6 +561,9 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
|
||||||
if (props->hasValue("label"))
|
if (props->hasValue("label"))
|
||||||
object->setLabel(props->getStringValue("label"));
|
object->setLabel(props->getStringValue("label"));
|
||||||
|
|
||||||
|
if (props->hasValue("border"))
|
||||||
|
object->setBorderThickness( props->getIntValue("border", 2) );
|
||||||
|
|
||||||
if ( SGPropertyNode *nft = props->getNode("font", false) ) {
|
if ( SGPropertyNode *nft = props->getNode("font", false) ) {
|
||||||
SGPath path( _font_path );
|
SGPath path( _font_path );
|
||||||
const char *name = nft->getStringValue("name", "default");
|
const char *name = nft->getStringValue("name", "default");
|
||||||
|
|
Loading…
Reference in a new issue