00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034 #include "llviewchildren.h"
00035
00036 #include "lluictrlfactory.h"
00037
00038
00039 #include "llbutton.h"
00040 #include "lliconctrl.h"
00041 #include "lltextbox.h"
00042 #include "lluuid.h"
00043 #include "llpanel.h"
00044 #include "llviewercontrol.h"
00045
00046
00047
00048
00049 LLViewChildren::LLViewChildren(LLPanel& parent)
00050 : mParent(parent)
00051 {
00052 }
00053
00054
00055 void LLViewChildren::show(const char* id, bool visible)
00056 {
00057 mParent.childSetVisible(id, visible);
00058 }
00059
00060 void LLViewChildren::enable(const char* id, bool enabled)
00061 {
00062 mParent.childSetEnabled(id, enabled);
00063 }
00064
00065 void LLViewChildren::setText(
00066 const char* id, const std::string& text, bool visible)
00067 {
00068 LLTextBox* child = mParent.getChild<LLTextBox>(id);
00069 if (child)
00070 {
00071 child->setVisible(visible);
00072 child->setText(text);
00073 }
00074 }
00075
00076 void LLViewChildren::setWrappedText(
00077 const char* id, const std::string& text, bool visible)
00078 {
00079 LLTextBox* child = mParent.getChild<LLTextBox>(id);
00080 if (child)
00081 {
00082 child->setVisible(visible);
00083 child->setWrappedText(text);
00084 }
00085 }
00086
00087 void LLViewChildren::setBadge(const char* id, Badge badge, bool visible)
00088 {
00089 LLIconCtrl* child = mParent.getChild<LLIconCtrl>(id);
00090 if (child)
00091 {
00092 child->setVisible(visible);
00093 switch (badge)
00094 {
00095 default:
00096 case BADGE_OK: child->setImage("badge_ok.j2c"); break;
00097 case BADGE_NOTE: child->setImage("badge_note.j2c"); break;
00098 case BADGE_WARN: child->setImage("badge_warn.j2c"); break;
00099 case BADGE_ERROR: child->setImage("badge_error.j2c"); break;
00100 }
00101 }
00102 }
00103
00104 void LLViewChildren::setAction(const char* id,
00105 void(*function)(void*), void* value)
00106 {
00107 LLButton* button = mParent.getChild<LLButton>(id);
00108 if (button)
00109 {
00110 button->setClickedCallback(function, value);
00111 }
00112 }
00113
00114