llviewchildren.cpp

Go to the documentation of this file.
00001 
00032 #include "llviewerprecompiledheaders.h"
00033 
00034 #include "llviewchildren.h"
00035 
00036 #include "lluictrlfactory.h"
00037 
00038 // viewer includes
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 // *NOTE: Do not use mParent reference in the constructor, since it is
00048 // potentially not fully constructud.
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 = LLUICtrlFactory::getTextBoxByName(&mParent, 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 = LLUICtrlFactory::getTextBoxByName(&mParent, 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         static LLUUID badgeOK(gViewerArt.getString("badge_ok.tga"));
00090         static LLUUID badgeNote(gViewerArt.getString("badge_note.tga"));
00091         static LLUUID badgeWarn(gViewerArt.getString("badge_warn.tga"));
00092         static LLUUID   badgeError(gViewerArt.getString("badge_error.tga"));
00093         
00094         LLUUID badgeUUID;
00095         switch (badge)
00096         {
00097                 default:
00098                 case BADGE_OK:          badgeUUID = badgeOK;    break;
00099                 case BADGE_NOTE:        badgeUUID = badgeNote;  break;
00100                 case BADGE_WARN:        badgeUUID = badgeWarn;  break;
00101                 case BADGE_ERROR:       badgeUUID = badgeError; break;
00102         }
00103         
00104         LLIconCtrl* child = LLUICtrlFactory::getIconByName(&mParent, id);
00105         if (child)
00106         {
00107                 child->setVisible(visible);
00108                 child->setImage(badgeUUID);
00109         }
00110 }
00111 
00112 void LLViewChildren::setAction(const char* id,
00113         void(*function)(void*), void* value)
00114 {
00115         LLButton* button = LLUICtrlFactory::getButtonByName(&mParent, id);
00116         if (button)
00117         {
00118                 button->setClickedCallback(function, value);
00119         }
00120 }
00121 
00122 

Generated on Thu Jul 1 06:09:26 2010 for Second Life Viewer by  doxygen 1.4.7