ecode code refactor.

This commit is contained in:
Martín Lucas Golini
2021-01-04 01:46:48 -03:00
parent 7493f6a1cd
commit a0d2f73864
18 changed files with 1244 additions and 1006 deletions

View File

@@ -31,17 +31,19 @@ template <typename T> class tSize : public Vector2<T> {
/** Set a new height */
void setHeight( const T& height );
tSize<T>& operator=( const tSize<T>& right );
};
template <typename T> tSize<T>::tSize() : Vector2<T>( 0, 0 ) {}
template <typename T>
tSize<T>::tSize( const T& Width, const T& Height ) : Vector2<T>( Width, Height ) {}
tSize<T>::tSize( const T& width, const T& height ) : Vector2<T>( width, height ) {}
template <typename T>
tSize<T>::tSize( const tSize<T>& Size ) : Vector2<T>( Size.getWidth(), Size.getHeight() ) {}
tSize<T>::tSize( const tSize<T>& size ) : Vector2<T>( size.getWidth(), size.getHeight() ) {}
template <typename T> tSize<T>::tSize( const Vector2<T>& Vec ) : Vector2<T>( Vec.x, Vec.y ) {}
template <typename T> tSize<T>::tSize( const Vector2<T>& vec ) : Vector2<T>( vec.x, vec.y ) {}
template <typename T> const T& tSize<T>::getWidth() const {
return this->x;
@@ -59,6 +61,12 @@ template <typename T> void tSize<T>::setHeight( const T& height ) {
this->y = height;
}
template <typename T> tSize<T>& tSize<T>::operator=( const tSize<T>& right ) {
this->x = right.x;
this->y = right.y;
return *this;
}
typedef tSize<int> Sizei;
typedef tSize<Float> Sizef;

View File

@@ -19,6 +19,8 @@ template <typename T> class Vector2 {
/** Creates a vector from its coordinates */
Vector2( T X, T Y );
Vector2( const Vector2<T>& copy ) : x( copy.x ), y( copy.y ) {}
/** @return A copy of the Vector2 */
Vector2<T> copy();
@@ -102,6 +104,8 @@ template <typename T> class Vector2 {
Vector2<int> asInt() const;
Vector2<T>& operator=( const Vector2<T>& right );
T x;
T y;
@@ -394,6 +398,12 @@ template <typename T> Vector2<int> Vector2<T>::asInt() const {
return Vector2<int>( x, y );
}
template <typename T> Vector2<T>& Vector2<T>::operator=( const Vector2<T>& right ) {
this->x = right.x;
this->y = right.y;
return *this;
}
template <typename T> bool Vector2<T>::nearDist( const Vector2<T>& Vec, T Dist ) const {
return 0 != ( distanceSq( Vec ) < Dist * Dist );
}

View File

@@ -6,6 +6,7 @@
#include <eepp/ui/uitablecell.hpp>
#include <eepp/ui/uitableheadercolumn.hpp>
#include <eepp/ui/uitablerow.hpp>
#include <unordered_map>
using namespace EE::Math;
@@ -99,6 +100,10 @@ class EE_API UIAbstractTableView : public UIAbstractView {
* possible. */
void setMainColumn( const size_t& mainColumn );
bool getSingleClickNavigation() const;
void setSingleClickNavigation( bool singleClickNavigation );
protected:
friend class EE::UI::UITableHeaderColumn;
@@ -122,9 +127,11 @@ class EE_API UIAbstractTableView : public UIAbstractView {
bool mAutoExpandOnSingleColumn{ false };
bool mAutoColumnsWidth{ false };
bool mRowSearchByName{ true };
bool mSingleClickNavigation{ false };
Action* mSearchTextAction{ nullptr };
std::string mSearchText;
size_t mMainColumn{ 0 };
std::unordered_map<UIWidget*, Uint32> mWidgetsClickCbId;
virtual ~UIAbstractTableView();
@@ -164,6 +171,8 @@ class EE_API UIAbstractTableView : public UIAbstractView {
virtual Uint32 onTextInput( const TextInputEvent& event );
virtual void bindNavigationClick( UIWidget* widget );
void updateHeaderSize();
int visibleColumn();

View File

@@ -190,6 +190,8 @@ class EE_API UITreeView : public UIAbstractTableView {
const ModelIndex& index );
virtual void onModelSelectionChange();
virtual void bindNavigationClick( UIWidget* widget );
};
}} // namespace EE::UI