CHANGED: #1471 CViewBitmapCombo no longer depends on CViewPointer.

--HG--
branch : gui-refactoring
This commit is contained in:
dfighter1985 2012-06-22 04:27:53 +02:00
parent 8b84170dec
commit 8193f484bf
5 changed files with 19 additions and 19 deletions

View file

@ -18,6 +18,7 @@
#ifndef VIEW_POINTER_BASE_H #ifndef VIEW_POINTER_BASE_H
#define VIEW_POINTER_BASE_H #define VIEW_POINTER_BASE_H
#include "nel/misc/events.h"
#include "nel/gui/view_base.h" #include "nel/gui/view_base.h"
namespace NLGUI namespace NLGUI
@ -52,6 +53,11 @@ namespace NLGUI
bool show() const {return _PointerVisible;} bool show() const {return _PointerVisible;}
void draw(){} void draw(){}
/// set button state
void setButtonState(NLMISC::TMouseButton state) { _Buttons = state; }
/// get buttons state
NLMISC::TMouseButton getButtonState() const { return _Buttons; }
protected: protected:
// (x,y) is from the TopLeft corner of the window // (x,y) is from the TopLeft corner of the window
@ -66,6 +72,8 @@ namespace NLGUI
bool _PointerDrag; // Is the pointer down and we have moved ? bool _PointerDrag; // Is the pointer down and we have moved ?
bool _PointerVisible; // Is the pointer visible or hidden ? bool _PointerVisible; // Is the pointer visible or hidden ?
NLMISC::TMouseButton _Buttons;
private: private:

View file

@ -21,7 +21,8 @@ namespace NLGUI
{ {
CViewPointerBase::CViewPointerBase( const CViewBase::TCtorParam &param ) : CViewPointerBase::CViewPointerBase( const CViewBase::TCtorParam &param ) :
CViewBase( param ) CViewBase( param ),
_Buttons( NLMISC::noButton )
{ {
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0; _PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
_PointerDown = false; _PointerDown = false;

View file

@ -14,13 +14,13 @@
// 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 "stdpch.h"
#include "view_bitmap_combo.h" #include "view_bitmap_combo.h"
#include "interface_manager.h"
#include "nel/misc/xml_auto_ptr.h" #include "nel/misc/xml_auto_ptr.h"
#include "nel/gui/db_manager.h"
#include "nel/gui/view_renderer.h"
#include "nel/gui/widget_manager.h"
#include "nel/gui/view_pointer_base.h"
#include "nel/gui/interface_group.h"
using namespace NLMISC; using namespace NLMISC;
@ -275,7 +275,6 @@ void CViewBitmapCombo::draw()
if (numRow == 0 || numCol == 0) return; if (numRow == 0 || numCol == 0) return;
sint32 mx = 0, my = 0; sint32 mx = 0, my = 0;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
const std::vector<CViewBase *> &rVB = CWidgetManager::getInstance()->getViewsUnderPointer(); const std::vector<CViewBase *> &rVB = CWidgetManager::getInstance()->getViewsUnderPointer();
if (!CWidgetManager::getInstance()->getPointer()) return; if (!CWidgetManager::getInstance()->getPointer()) return;
@ -361,7 +360,7 @@ void CViewBitmapCombo::draw()
&& my < py + (sint32) itemh) && my < py + (sint32) itemh)
{ {
overItem = true; overItem = true;
if ( static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() )->getButtonState() & NLMISC::leftButton) if ( CWidgetManager::getInstance()->getPointer()->getButtonState() & NLMISC::leftButton)
{ {
textId = getTexId(_TexsPushedId, texIndex); textId = getTexId(_TexsPushedId, texIndex);
color = getCol(_ColPushed, texIndex); color = getCol(_ColPushed, texIndex);
@ -416,7 +415,7 @@ void CViewBitmapCombo::draw()
// //
if (_CD.Unrolled.getBool()) if (_CD.Unrolled.getBool())
{ {
if (overItem && static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() )->getButtonState() & NLMISC::leftButton) if (overItem && CWidgetManager::getInstance()->getPointer()->getButtonState() & NLMISC::leftButton)
{ {
textId = getTexId(_TexsId, selectedTexIndex); textId = getTexId(_TexsId, selectedTexIndex);
color = getCol(_Col, selectedTexIndex); color = getCol(_Col, selectedTexIndex);
@ -436,7 +435,7 @@ void CViewBitmapCombo::draw()
&& my < py + (sint32) itemh && my < py + (sint32) itemh
) )
{ {
if ( static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() )->getButtonState() & NLMISC::leftButton) if ( CWidgetManager::getInstance()->getPointer()->getButtonState() & NLMISC::leftButton)
{ {
textId = getTexId(_TexsPushedId, selectedTexIndex); textId = getTexId(_TexsPushedId, selectedTexIndex);
color = getCol(_ColPushed, selectedTexIndex); color = getCol(_ColPushed, selectedTexIndex);

View file

@ -42,8 +42,7 @@ NLMISC_REGISTER_OBJECT(CViewBase, CViewPointer, std::string, "pointer");
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
CViewPointer::CViewPointer (const TCtorParam &param) CViewPointer::CViewPointer (const TCtorParam &param)
: CViewPointerBase(param), : CViewPointerBase(param)
_Buttons(NLMISC::noButton)
{ {
_TxIdDefault = -2; _TxIdDefault = -2;
_TxIdMoveWindow = -2; _TxIdMoveWindow = -2;

View file

@ -63,11 +63,6 @@ public:
} }
// TEMP PATCH // TEMP PATCH
/// set button state
void setButtonState(NLMISC::TMouseButton state) { _Buttons = state; }
/// get buttons state
NLMISC::TMouseButton getButtonState() const { return _Buttons; }
private: private:
/// Show or hide the pointer. Please, use SetMouseMode (bool freelook) instead. /// Show or hide the pointer. Please, use SetMouseMode (bool freelook) instead.
@ -120,8 +115,6 @@ private:
sint32 _OffsetX; sint32 _OffsetX;
sint32 _OffsetY; sint32 _OffsetY;
NLMISC::TMouseButton _Buttons;
CGroupContainer *_LastHightLight; CGroupContainer *_LastHightLight;
// Cursor mode // Cursor mode