2013-11-27 18:38:07 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef TEXT_TABLE_H
|
|
|
|
#define TEXT_TABLE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <InterfaceDefs.h>
|
|
|
|
#include <ObjectList.h>
|
|
|
|
#include <StringList.h>
|
|
|
|
|
|
|
|
|
2013-11-30 19:18:03 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
|
2013-11-27 18:38:07 +04:00
|
|
|
class TextTable {
|
|
|
|
public:
|
|
|
|
TextTable();
|
|
|
|
~TextTable();
|
|
|
|
|
|
|
|
int32 CountColumns() const;
|
|
|
|
void AddColumn(const BString& title,
|
|
|
|
enum alignment align = B_ALIGN_LEFT,
|
|
|
|
bool canTruncate = false);
|
|
|
|
|
|
|
|
int32 CountRows() const;
|
|
|
|
BString TextAt(int32 rowIndex, int32 columnIndex) const;
|
|
|
|
void SetTextAt(int32 rowIndex, int32 columnIndex,
|
|
|
|
const BString& text);
|
|
|
|
|
|
|
|
void Print(int32 maxWidth);
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Column;
|
|
|
|
typedef BObjectList<Column> ColumnList;
|
|
|
|
typedef BObjectList<BStringList> RowList;
|
|
|
|
|
|
|
|
private:
|
|
|
|
ColumnList fColumns;
|
|
|
|
RowList fRows;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-11-30 19:18:03 +04:00
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
|
|
|
|
using ::BPrivate::TextTable;
|
|
|
|
|
|
|
|
|
2013-11-27 18:38:07 +04:00
|
|
|
#endif // TEXT_TABLE_H
|