Allow for recolloring the dialogs.
This commit is contained in:
parent
88a678eb77
commit
3f6536fee6
2 changed files with 16 additions and 5 deletions
|
@ -390,6 +390,15 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
|
||||||
int x = props->getIntValue("x", (parentWidth - width) / 2);
|
int x = props->getIntValue("x", (parentWidth - width) / 2);
|
||||||
int y = props->getIntValue("y", (parentHeight - height) / 2);
|
int y = props->getIntValue("y", (parentHeight - height) / 2);
|
||||||
|
|
||||||
|
sgVec4 color = {0.8, 0.8, 0.9, 0.85};
|
||||||
|
SGPropertyNode *ncs = props->getNode("color", false);
|
||||||
|
if ( ncs ) {
|
||||||
|
color[0] = ncs->getFloatValue("red", 0.8);
|
||||||
|
color[1] = ncs->getFloatValue("green", 0.8);
|
||||||
|
color[2] = ncs->getFloatValue("blue", 0.9);
|
||||||
|
color[3] = ncs->getFloatValue("alpha", 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
string type = props->getName();
|
string type = props->getName();
|
||||||
if (type == "")
|
if (type == "")
|
||||||
type = "dialog";
|
type = "dialog";
|
||||||
|
@ -400,11 +409,11 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
|
||||||
dialog = new puDialogBox(x, y);
|
dialog = new puDialogBox(x, y);
|
||||||
else
|
else
|
||||||
dialog = new fgPopup(x, y);
|
dialog = new fgPopup(x, y);
|
||||||
setupGroup(dialog, props, width, height, true);
|
setupGroup(dialog, props, width, height, color, true);
|
||||||
return dialog;
|
return dialog;
|
||||||
} else if (type == "group") {
|
} else if (type == "group") {
|
||||||
puGroup * group = new puGroup(x, y);
|
puGroup * group = new puGroup(x, y);
|
||||||
setupGroup(group, props, width, height, false);
|
setupGroup(group, props, width, height, color, false);
|
||||||
return group;
|
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);
|
||||||
|
@ -561,13 +570,13 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
|
||||||
|
|
||||||
void
|
void
|
||||||
FGDialog::setupGroup (puGroup * group, SGPropertyNode * props,
|
FGDialog::setupGroup (puGroup * group, SGPropertyNode * props,
|
||||||
int width, int height, bool makeFrame)
|
int width, int height, sgVec4 color, bool makeFrame)
|
||||||
{
|
{
|
||||||
setupObject(group, props);
|
setupObject(group, props);
|
||||||
|
|
||||||
if (makeFrame) {
|
if (makeFrame) {
|
||||||
puFrame* f = new puFrame(0, 0, width, height);
|
puFrame* f = new puFrame(0, 0, width, height);
|
||||||
f->setColorScheme(0.8, 0.8, 0.9, 0.85);
|
f->setColorScheme(color[0], color[1], color[2], color[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nChildren = props->nChildren();
|
int nChildren = props->nChildren();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <plib/pu.h>
|
#include <plib/pu.h>
|
||||||
|
#include <plib/sg.h>
|
||||||
|
|
||||||
#include <simgear/compiler.h> // for SG_USING_STD
|
#include <simgear/compiler.h> // for SG_USING_STD
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
|
@ -113,7 +114,8 @@ private:
|
||||||
|
|
||||||
// Common configuration for all GUI group objects.
|
// Common configuration for all GUI group objects.
|
||||||
void setupGroup (puGroup * group, SGPropertyNode * props,
|
void setupGroup (puGroup * group, SGPropertyNode * props,
|
||||||
int width, int height, bool makeFrame = false);
|
int width, int height, sgVec4 color,
|
||||||
|
bool makeFrame = false);
|
||||||
|
|
||||||
// The top-level PUI object.
|
// The top-level PUI object.
|
||||||
puObject * _object;
|
puObject * _object;
|
||||||
|
|
Loading…
Reference in a new issue