CHANGED: #1471 CCtrlButton is now under the NLGUI namespace.

This commit is contained in:
dfighter1985 2012-06-16 00:49:40 +02:00
parent 84fe4773fb
commit 892a8131ca
6 changed files with 352 additions and 337 deletions

View file

@ -25,17 +25,16 @@
namespace NLGUI namespace NLGUI
{ {
class CEventDescriptor; class CEventDescriptor;
}
/** /**
* <Class description> * <Class description>
* \author Nicolas Brigand * \author Nicolas Brigand
* \author Nevrax France * \author Nevrax France
* \date 2002 * \date 2002
*/ */
class CCtrlButton : public CCtrlBaseButton class CCtrlButton : public CCtrlBaseButton
{ {
public: public:
/// Constructor /// Constructor
CCtrlButton(const TCtorParam &param) : CCtrlBaseButton(param) CCtrlButton(const TCtorParam &param) : CCtrlBaseButton(param)
@ -84,18 +83,19 @@ public:
REFLECT_BOOL("scale", getScale, setScale); REFLECT_BOOL("scale", getScale, setScale);
REFLECT_EXPORT_END REFLECT_EXPORT_END
protected: protected:
CViewRenderer::CTextureId _TextureIdNormal; CViewRenderer::CTextureId _TextureIdNormal;
CViewRenderer::CTextureId _TextureIdPushed; CViewRenderer::CTextureId _TextureIdPushed;
CViewRenderer::CTextureId _TextureIdOver; CViewRenderer::CTextureId _TextureIdOver;
private: private:
bool _Scale; bool _Scale;
sint32 _Align; /// 1st bit - Left/Right (0/1) 2nd bit - Bottom/Top (0/1) sint32 _Align; /// 1st bit - Left/Right (0/1) 2nd bit - Bottom/Top (0/1)
}; };
}
#endif // RZ_CTRL_BUTTON_H #endif // RZ_CTRL_BUTTON_H

View file

@ -14,9 +14,6 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/gui/ctrl_button.h" #include "nel/gui/ctrl_button.h"
#include "nel/misc/xml_auto_ptr.h" #include "nel/misc/xml_auto_ptr.h"
#include "nel/gui/widget_manager.h" #include "nel/gui/widget_manager.h"
@ -29,9 +26,12 @@ using namespace NL3D;
NLMISC_REGISTER_OBJECT(CViewBase, CCtrlButton, std::string, "button"); NLMISC_REGISTER_OBJECT(CViewBase, CCtrlButton, std::string, "button");
// ---------------------------------------------------------------------------- namespace NLGUI
bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {
// ----------------------------------------------------------------------------
bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
{
CXMLAutoPtr prop; CXMLAutoPtr prop;
//try to get props that can be inherited from groups //try to get props that can be inherited from groups
//if a property is not defined, try to find it in the parent group. //if a property is not defined, try to find it in the parent group.
@ -97,11 +97,11 @@ bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
return true; return true;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CCtrlButton::draw () void CCtrlButton::draw ()
{ {
sint32 nTxId = -1; sint32 nTxId = -1;
CRGBA color; CRGBA color;
@ -149,7 +149,7 @@ void CCtrlButton::draw ()
break; break;
case RadioButton: case RadioButton:
{ {
// CViewPointer &rIP = *CInterfaceManager::getInstance()->getPointer(); // CViewPointer &rIP = *CInterfaceManager::getInstance()->getPointer();
// Init the radio button // Init the radio button
initRBRef(); initRBRef();
@ -238,12 +238,12 @@ void CCtrlButton::draw ()
_TextureIdOver, _TextureIdOver,
color ); color );
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CCtrlButton::updateCoords() void CCtrlButton::updateCoords()
{ {
if (!_Scale) if (!_Scale)
{ {
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
@ -253,81 +253,81 @@ void CCtrlButton::updateCoords()
_H = txh; _H = txh;
} }
CViewBase::updateCoords(); CViewBase::updateCoords();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CCtrlButton::setTexture(const std::string&name) void CCtrlButton::setTexture(const std::string&name)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdNormal.setTexture(name.c_str()); _TextureIdNormal.setTexture(name.c_str());
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CCtrlButton::setTexturePushed(const std::string&name) void CCtrlButton::setTexturePushed(const std::string&name)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdPushed.setTexture(name.c_str()); _TextureIdPushed.setTexture(name.c_str());
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CCtrlButton::setTextureOver(const std::string&name) void CCtrlButton::setTextureOver(const std::string&name)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdOver.setTexture(name.c_str()); _TextureIdOver.setTexture(name.c_str());
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
std::string CCtrlButton::getTexture() const std::string CCtrlButton::getTexture() const
{ {
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdNormal); return rVR.getTextureNameFromId(_TextureIdNormal);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
std::string CCtrlButton::getTexturePushed() const std::string CCtrlButton::getTexturePushed() const
{ {
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdPushed); return rVR.getTextureNameFromId(_TextureIdPushed);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
std::string CCtrlButton::getTextureOver() const std::string CCtrlButton::getTextureOver() const
{ {
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdOver); return rVR.getTextureNameFromId(_TextureIdOver);
} }
// *************************************************************************** // ***************************************************************************
sint32 CCtrlButton::getMaxUsedW() const sint32 CCtrlButton::getMaxUsedW() const
{ {
sint32 txw, txh; sint32 txw, txh;
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh); rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh);
return txw; return txw;
} }
// *************************************************************************** // ***************************************************************************
sint32 CCtrlButton::getMinUsedW() const sint32 CCtrlButton::getMinUsedW() const
{ {
return getMaxUsedW(); return getMaxUsedW();
} }
// *************************************************************************** // ***************************************************************************
void CCtrlButton::fitTexture() void CCtrlButton::fitTexture()
{ {
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 w, h; sint32 w, h;
rVR.getTextureSizeFromId(_TextureIdNormal, w, h); rVR.getTextureSizeFromId(_TextureIdNormal, w, h);
setW(w); setW(w);
setH(h); setH(h);
} }
// *************************************************************************** // ***************************************************************************
bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col) bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col)
{ {
if (_AHOnLeftClickString == "browse") if (_AHOnLeftClickString == "browse")
{ {
if (!_AHOnLeftClickStringParams.empty()) if (!_AHOnLeftClickStringParams.empty())
@ -344,4 +344,7 @@ bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col)
} }
return false; return false;
}
} }

View file

@ -27,9 +27,13 @@
#include "dbctrl_sheet.h" #include "dbctrl_sheet.h"
#include "view_text.h" #include "view_text.h"
namespace NLGUI
{
class CCtrlButton;
}
// *************************************************************************** // ***************************************************************************
class CCtrlButton;
class CCtrlScroll; class CCtrlScroll;
class CHandlerListSheetTradeSelect; class CHandlerListSheetTradeSelect;
class CHandlerListSheetTradeRightClick; class CHandlerListSheetTradeRightClick;

View file

@ -23,9 +23,13 @@
#include "dbgroup_list_sheet_text.h" #include "dbgroup_list_sheet_text.h"
#include "game_share/bot_chat_types.h" #include "game_share/bot_chat_types.h"
namespace NLGUI
{
class CCtrlButton;
}
// *************************************************************************** // ***************************************************************************
class CCtrlButton;
class CCtrlScroll; class CCtrlScroll;
class CHandlerListSheetTradeSelect; class CHandlerListSheetTradeSelect;
class CHandlerListSheetTradeRightClick; class CHandlerListSheetTradeRightClick;

View file

@ -26,10 +26,10 @@
namespace NLGUI namespace NLGUI
{ {
class CEventDescriptorLocalised; class CEventDescriptorLocalised;
class CCtrlButton;
} }
class CInterfaceList; class CInterfaceList;
class CCtrlButton;
class CCtrlScroll; class CCtrlScroll;
class CViewText; class CViewText;
class COptionsContainerInsertion; class COptionsContainerInsertion;

View file

@ -37,9 +37,13 @@ extern "C"
#include "WWWInit.h" #include "WWWInit.h"
} }
namespace NLGUI
{
class CCtrlButton;
}
class CGroupList; class CGroupList;
class CCtrlScroll; class CCtrlScroll;
class CCtrlButton;
class CDBGroupComboBox; class CDBGroupComboBox;
class CGroupParagraph; class CGroupParagraph;