mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 23:56:15 +00:00
CHANGED: #1471 CGroupTable and CGroupCell are now part of the NELGUI library and are under the NLGUI namespace.
This commit is contained in:
parent
e209a6c77d
commit
215f7124d2
8 changed files with 1299 additions and 1291 deletions
216
code/nel/include/nel/gui/group_table.h
Normal file
216
code/nel/include/nel/gui/group_table.h
Normal file
|
@ -0,0 +1,216 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// 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/>.
|
||||
|
||||
|
||||
|
||||
#ifndef NL_GROUP_TABLE_H
|
||||
#define NL_GROUP_TABLE_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/group_frame.h"
|
||||
#include "nel/gui/view_text.h"
|
||||
#include "nel/gui/ctrl_button.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
/**
|
||||
* This group is used to simulate HTML cells.
|
||||
* They have specific parameters to be aligned like HTML cells.
|
||||
* (Percent of the table size
|
||||
*/
|
||||
class CGroupCell: public CInterfaceGroup
|
||||
{
|
||||
friend class CGroupTable;
|
||||
public:
|
||||
CGroupCell(const TCtorParam ¶m);
|
||||
|
||||
enum TAlign
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
};
|
||||
|
||||
enum TVAlign
|
||||
{
|
||||
Top,
|
||||
Middle,
|
||||
Bottom
|
||||
};
|
||||
|
||||
/// \from CInterfaceElement
|
||||
virtual void draw();
|
||||
virtual sint32 getMaxUsedW() const;
|
||||
virtual sint32 getMinUsedW() const;
|
||||
|
||||
// to be called by CGroupTable
|
||||
bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup, uint columnIndex, uint rowIndex);
|
||||
|
||||
// If the cell is a new line. This is the first <td> after a <tr>
|
||||
bool NewLine;
|
||||
bool IgnoreMaxWidth;
|
||||
bool IgnoreMinWidth;
|
||||
bool AddChildW;
|
||||
|
||||
// The table width cell ratio. This is the <td width="50%"> parameter
|
||||
float TableRatio;
|
||||
|
||||
// The Width you want in pixel. This is the <td width="100"> parameter
|
||||
sint32 WidthWanted;
|
||||
|
||||
|
||||
// The min height of the cell
|
||||
sint32 Height;
|
||||
|
||||
// Memorize max width
|
||||
sint32 WidthMax;
|
||||
|
||||
// The cell color
|
||||
NLMISC::CRGBA BgColor;
|
||||
|
||||
// Texture
|
||||
CViewRenderer::CTextureId _TextureId; /// Accelerator
|
||||
bool _UserTexture;
|
||||
bool _TextureTiled;
|
||||
bool _TextureScaled;
|
||||
|
||||
// Alignment
|
||||
TAlign Align;
|
||||
TVAlign VAlign;
|
||||
sint32 LeftMargin;
|
||||
|
||||
// The cell group
|
||||
CInterfaceGroup *Group;
|
||||
|
||||
// The cell is nowrap
|
||||
bool NoWrap;
|
||||
|
||||
void setTexture(const std::string & TxName);
|
||||
void setTextureTile(bool tiled);
|
||||
void setTextureScale(bool scaled);
|
||||
|
||||
static void setDebugUICell( bool d ){ DebugUICell = d; }
|
||||
static bool getDebugUICell(){ return DebugUICell; }
|
||||
|
||||
private:
|
||||
void setEnclosedGroupDefaultParams();
|
||||
static bool DebugUICell;
|
||||
};
|
||||
|
||||
/**
|
||||
* This group is used to simulate HTML table. Support "percent of the parent width" sizeRef mode.
|
||||
*/
|
||||
class CGroupTable : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
|
||||
///constructor
|
||||
CGroupTable(const TCtorParam ¶m);
|
||||
|
||||
// dtor
|
||||
~CGroupTable();
|
||||
|
||||
// Add a cell in the table
|
||||
void addChild (CGroupCell* child);
|
||||
|
||||
// The ratio you want [0 ~1]. This is the <table width="50%"> parameter
|
||||
float TableRatio;
|
||||
|
||||
// The Width you want in pixel. This is the <table width="100"> parameter
|
||||
sint32 ForceWidthMin;
|
||||
|
||||
// Table borders
|
||||
sint32 Border;
|
||||
sint32 CellPadding;
|
||||
sint32 CellSpacing;
|
||||
|
||||
// The table color
|
||||
NLMISC::CRGBA BgColor;
|
||||
uint8 CurrentAlpha;
|
||||
|
||||
bool ContinuousUpdate;
|
||||
|
||||
protected:
|
||||
|
||||
/// \from CInterfaceElement
|
||||
void onInvalidateContent();
|
||||
sint32 getMaxUsedW() const;
|
||||
sint32 getMinUsedW() const;
|
||||
void draw ();
|
||||
|
||||
/**
|
||||
* init or reset the children element coords. Orverloaded from CInterfaceGroup because we begin with the last inserted element here
|
||||
*/
|
||||
virtual void updateCoords();
|
||||
|
||||
virtual void checkCoords();
|
||||
|
||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
||||
|
||||
// Content validated
|
||||
bool _ContentValidated;
|
||||
|
||||
// Last parent width
|
||||
sint32 _LastParentW;
|
||||
|
||||
// Children
|
||||
std::vector<CGroupCell *> _Cells;
|
||||
|
||||
// Table column
|
||||
class CColumn
|
||||
{
|
||||
public:
|
||||
CColumn()
|
||||
{
|
||||
Width = 0;
|
||||
WidthMax = 0;
|
||||
WidthWanted = 0;
|
||||
TableRatio = 0;
|
||||
Height = 0;
|
||||
}
|
||||
sint32 Width;
|
||||
sint32 Height;
|
||||
sint32 WidthWanted;
|
||||
sint32 WidthMax;
|
||||
float TableRatio;
|
||||
};
|
||||
|
||||
// Table row
|
||||
class CRow
|
||||
{
|
||||
public:
|
||||
CRow()
|
||||
{
|
||||
Height = 0;
|
||||
}
|
||||
sint32 Height;
|
||||
};
|
||||
|
||||
// Column table
|
||||
std::vector<CColumn> _Columns;
|
||||
|
||||
// Column table
|
||||
std::vector<CRow> _Rows;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NL_GROUP_TABLE_H
|
||||
|
||||
/* End of group_table.h */
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ namespace NLGUI
|
|||
virtual void addLuaClassAssociation( CInterfaceGroup *group, const std::string &luaScript ) = 0;
|
||||
virtual CInterfaceGroup* createGroupInstance( const std::string &templateName, const std::string &parentID, const std::pair< std::string, std::string > *templateParams, uint numParams, bool updateLinks = true ) = 0;
|
||||
virtual CInterfaceGroup* createGroupInstance( const std::string &templateName, const std::string &parentID, std::vector< std::pair< std::string, std::string > > &templateParams, bool updateLinks = true ) = 0;
|
||||
virtual bool parseGroupChildren( xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload );
|
||||
virtual bool parseGroupChildren( xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload ) = 0;
|
||||
};
|
||||
|
||||
/// Manages the GUI widgets
|
||||
|
|
1078
code/nel/src/gui/group_table.cpp
Normal file
1078
code/nel/src/gui/group_table.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,7 @@
|
|||
#include "nel/gui/group_scrolltext.h"
|
||||
#include "nel/gui/group_tree.h"
|
||||
#include "nel/gui/ctrl_button.h"
|
||||
#include "group_table.h"
|
||||
#include "nel/gui/group_table.h"
|
||||
|
||||
typedef std::map<std::string, std::string> TStyle;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,212 +0,0 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// 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/>.
|
||||
|
||||
|
||||
|
||||
#ifndef NL_GROUP_TABLE_H
|
||||
#define NL_GROUP_TABLE_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/group_frame.h"
|
||||
#include "nel/gui/view_text.h"
|
||||
#include "nel/gui/ctrl_button.h"
|
||||
|
||||
/**
|
||||
* This group is used to simulate HTML cells.
|
||||
* They have specific parameters to be aligned like HTML cells.
|
||||
* (Percent of the table size
|
||||
*/
|
||||
class CGroupCell: public CInterfaceGroup
|
||||
{
|
||||
friend class CGroupTable;
|
||||
public:
|
||||
CGroupCell(const TCtorParam ¶m);
|
||||
|
||||
enum TAlign
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
};
|
||||
|
||||
enum TVAlign
|
||||
{
|
||||
Top,
|
||||
Middle,
|
||||
Bottom
|
||||
};
|
||||
|
||||
/// \from CInterfaceElement
|
||||
virtual void draw();
|
||||
virtual sint32 getMaxUsedW() const;
|
||||
virtual sint32 getMinUsedW() const;
|
||||
|
||||
// to be called by CGroupTable
|
||||
bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup, uint columnIndex, uint rowIndex);
|
||||
|
||||
// If the cell is a new line. This is the first <td> after a <tr>
|
||||
bool NewLine;
|
||||
bool IgnoreMaxWidth;
|
||||
bool IgnoreMinWidth;
|
||||
bool AddChildW;
|
||||
|
||||
// The table width cell ratio. This is the <td width="50%"> parameter
|
||||
float TableRatio;
|
||||
|
||||
// The Width you want in pixel. This is the <td width="100"> parameter
|
||||
sint32 WidthWanted;
|
||||
|
||||
|
||||
// The min height of the cell
|
||||
sint32 Height;
|
||||
|
||||
// Memorize max width
|
||||
sint32 WidthMax;
|
||||
|
||||
// The cell color
|
||||
NLMISC::CRGBA BgColor;
|
||||
|
||||
// Texture
|
||||
CViewRenderer::CTextureId _TextureId; /// Accelerator
|
||||
bool _UserTexture;
|
||||
bool _TextureTiled;
|
||||
bool _TextureScaled;
|
||||
|
||||
// Alignment
|
||||
TAlign Align;
|
||||
TVAlign VAlign;
|
||||
sint32 LeftMargin;
|
||||
|
||||
// The cell group
|
||||
CInterfaceGroup *Group;
|
||||
|
||||
// The cell is nowrap
|
||||
bool NoWrap;
|
||||
|
||||
void setTexture(const std::string & TxName);
|
||||
void setTextureTile(bool tiled);
|
||||
void setTextureScale(bool scaled);
|
||||
|
||||
static void setDebugUICell( bool d ){ DebugUICell = d; }
|
||||
static bool getDebugUICell(){ return DebugUICell; }
|
||||
|
||||
private:
|
||||
void setEnclosedGroupDefaultParams();
|
||||
static bool DebugUICell;
|
||||
};
|
||||
|
||||
/**
|
||||
* This group is used to simulate HTML table. Support "percent of the parent width" sizeRef mode.
|
||||
*/
|
||||
class CGroupTable : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
|
||||
///constructor
|
||||
CGroupTable(const TCtorParam ¶m);
|
||||
|
||||
// dtor
|
||||
~CGroupTable();
|
||||
|
||||
// Add a cell in the table
|
||||
void addChild (CGroupCell* child);
|
||||
|
||||
// The ratio you want [0 ~1]. This is the <table width="50%"> parameter
|
||||
float TableRatio;
|
||||
|
||||
// The Width you want in pixel. This is the <table width="100"> parameter
|
||||
sint32 ForceWidthMin;
|
||||
|
||||
// Table borders
|
||||
sint32 Border;
|
||||
sint32 CellPadding;
|
||||
sint32 CellSpacing;
|
||||
|
||||
// The table color
|
||||
NLMISC::CRGBA BgColor;
|
||||
uint8 CurrentAlpha;
|
||||
|
||||
bool ContinuousUpdate;
|
||||
|
||||
protected:
|
||||
|
||||
/// \from CInterfaceElement
|
||||
void onInvalidateContent();
|
||||
sint32 getMaxUsedW() const;
|
||||
sint32 getMinUsedW() const;
|
||||
void draw ();
|
||||
|
||||
/**
|
||||
* init or reset the children element coords. Orverloaded from CInterfaceGroup because we begin with the last inserted element here
|
||||
*/
|
||||
virtual void updateCoords();
|
||||
|
||||
virtual void checkCoords();
|
||||
|
||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
||||
|
||||
// Content validated
|
||||
bool _ContentValidated;
|
||||
|
||||
// Last parent width
|
||||
sint32 _LastParentW;
|
||||
|
||||
// Children
|
||||
std::vector<CGroupCell *> _Cells;
|
||||
|
||||
// Table column
|
||||
class CColumn
|
||||
{
|
||||
public:
|
||||
CColumn()
|
||||
{
|
||||
Width = 0;
|
||||
WidthMax = 0;
|
||||
WidthWanted = 0;
|
||||
TableRatio = 0;
|
||||
Height = 0;
|
||||
}
|
||||
sint32 Width;
|
||||
sint32 Height;
|
||||
sint32 WidthWanted;
|
||||
sint32 WidthMax;
|
||||
float TableRatio;
|
||||
};
|
||||
|
||||
// Table row
|
||||
class CRow
|
||||
{
|
||||
public:
|
||||
CRow()
|
||||
{
|
||||
Height = 0;
|
||||
}
|
||||
sint32 Height;
|
||||
};
|
||||
|
||||
// Column table
|
||||
std::vector<CColumn> _Columns;
|
||||
|
||||
// Column table
|
||||
std::vector<CRow> _Rows;
|
||||
};
|
||||
|
||||
|
||||
#endif // NL_GROUP_TABLE_H
|
||||
|
||||
/* End of group_table.h */
|
||||
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
#include "group_in_scene_bubble.h"
|
||||
#include "group_phrase_skill_filter.h"
|
||||
#include "nel/gui/group_tab.h"
|
||||
#include "group_table.h"
|
||||
#include "nel/gui/group_table.h"
|
||||
// DBGroup
|
||||
#include "nel/gui/dbgroup_select_number.h"
|
||||
#include "dbgroup_list_sheet.h"
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
#include "string_manager_client.h"
|
||||
|
||||
#include "nel/gui/lua_manager.h"
|
||||
#include "interface_v3/group_table.h"
|
||||
#include "nel/gui/group_table.h"
|
||||
|
||||
|
||||
///////////
|
||||
|
@ -4427,7 +4427,7 @@ NLMISC_COMMAND(debugUIGroup, "Debug the ui : show/hide quads of bboxs and hotspo
|
|||
// show hide the debuging of cells
|
||||
NLMISC_COMMAND(debugUICell, "Debug the ui : show/hide quads of bboxs for cells", "")
|
||||
{
|
||||
CGroupCell::setDebugUICell( !CGroupCell::getDebugUICell() )
|
||||
CGroupCell::setDebugUICell( !CGroupCell::getDebugUICell() );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue