2022-05-21 19:58:09 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include "StringBase.h"
|
|
|
|
#include "HorizontalAlignment.h"
|
|
|
|
|
|
|
|
namespace Forms
|
|
|
|
{
|
|
|
|
// Externally defined so we don't conflict
|
|
|
|
class ListView;
|
|
|
|
|
|
|
|
// Displays a single column header in a ListView control.
|
|
|
|
class ColumnHeader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ColumnHeader();
|
2022-05-21 21:51:35 +02:00
|
|
|
ColumnHeader(const String& Text);
|
|
|
|
ColumnHeader(const String& Text, int32_t Width);
|
|
|
|
ColumnHeader(const String& Text, int32_t Width, HorizontalAlignment Alignment);
|
2022-05-21 19:58:09 +02:00
|
|
|
~ColumnHeader() = default;
|
|
|
|
|
|
|
|
// The index of this column.
|
|
|
|
int32_t Index() const;
|
|
|
|
|
|
|
|
// The index of this column as it is displayed.
|
|
|
|
int32_t DisplayIndex();
|
|
|
|
// The index of this column as it is displayed.
|
|
|
|
void SetDisplayIndex(int32_t Value);
|
|
|
|
|
|
|
|
// Sets the display index without reflowing others.
|
|
|
|
void SetDisplayIndexInternal(int32_t Value);
|
|
|
|
|
|
|
|
// The text displayed in the column header.
|
2022-05-21 21:51:35 +02:00
|
|
|
const String& Text() const;
|
2022-05-21 19:58:09 +02:00
|
|
|
// The text displayed in the column header.
|
2022-05-21 21:51:35 +02:00
|
|
|
void SetText(const String& Value);
|
2022-05-21 19:58:09 +02:00
|
|
|
|
|
|
|
// The width of the column in pixels.
|
|
|
|
int32_t Width() const;
|
|
|
|
// The width of the column in pixels.
|
|
|
|
void SetWidth(int32_t Value);
|
|
|
|
|
|
|
|
// The horizontal alignment of the text contained in this column.
|
|
|
|
HorizontalAlignment TextAlign() const;
|
|
|
|
// The horizontal alignment of the text contained in this column.
|
|
|
|
void SetTextAlign(HorizontalAlignment Value);
|
|
|
|
|
|
|
|
// Returns the ListView control that this column is displayed in. May be null.
|
|
|
|
ListView* GetListView();
|
|
|
|
// Sets the ListView control that this column is displayed in.
|
|
|
|
void SetListView(ListView* Owner);
|
|
|
|
|
|
|
|
// Custom equality operator
|
|
|
|
bool operator==(const ColumnHeader& Rhs);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Internal cached properties
|
|
|
|
ListView* _OwnerListView;
|
|
|
|
|
|
|
|
// Width and index
|
|
|
|
int32_t _Width;
|
|
|
|
int32_t _IndexInternal;
|
|
|
|
|
|
|
|
// Text to display
|
2022-05-21 21:51:35 +02:00
|
|
|
String _Text;
|
2022-05-21 19:58:09 +02:00
|
|
|
HorizontalAlignment _TextAlign;
|
|
|
|
|
|
|
|
// Set the display indices of the ListView columns.
|
|
|
|
void SetDisplayIndices(const std::unique_ptr<int32_t[]>& Cols, int32_t Count);
|
|
|
|
};
|
|
|
|
}
|