CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FxUIModelIndex.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2023 by Graebert GmbH.
3//
4// Permission to use, copy, modify, and distribute this software in
5// object code form for any purpose and without fee is hereby granted,
6// provided that the above copyright notice appears in all copies and
7// that both that copyright notice and the limited warranty and
8// restricted rights notice below appear in all supporting
9// documentation.
10//
11// GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12// GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15// UNINTERRUPTED OR ERROR FREE.
16
17#pragma once
18
19#include "../../sdk/UI/FxUIObject.h"
20
22
24{
26public:
27
29 DisplayRole = 0,
30 DecorationRole = 1,
31 EditRole = 2,
32 ToolTipRole = 3,
33 FontRole = 6,
34 BackgroundColorRole = 8,
35 TextColorRole = 9,
36
37 // Reserved
38 UserRole = 0x0100
39 };
40
42 NoItemFlags = 0,
43 ItemIsSelectable = 1,
44 ItemIsEditable = 2,
45 ItemIsEnabled = 32,
46 };
47
48
50 Horizontal = 0x1,
51 Vertical = 0x2
52 };
53
54 inline CFxUIModelIndex() : r( -1 ), c( -1 ), i( 0 ), m( nullptr ) {};
55 // compiler-generated copy/move ctors/assignment operators are fine!
56 inline int row() const { return r; };
57 inline int column() const { return c; };
58 inline quintptr internalId() const { return i; };
59 inline void *internalPointer() const { return reinterpret_cast< void* >( i ); };
60 inline CFxUIModelIndex parent() const;
61 inline CFxUIVariant data( int role = UIDataRole::DisplayRole ) const;
62 inline UIItemFlags flags() const;
63 inline const CFxUIAbstractItemModel *model() const { return m; };
64 inline bool isValid() const { return ( r >= 0 ) && ( c >= 0 ) && ( m != nullptr ); };
65 inline bool operator==( const CFxUIModelIndex &other ) const
66 {
67 return ( other.r == r ) && ( other.i == i ) && ( other.c == c ) && ( other.m == m );
68 };
69 inline bool operator!=( const CFxUIModelIndex &other ) const
70 {
71 return !( *this == other );
72 };
73 inline bool operator<( const CFxUIModelIndex &other ) const
74 {
75 return r < other.r
76 || ( r == other.r && ( c < other.c
77 || ( c == other.c && ( i < other.i
78 || ( i == other.i && std::less<const CFxUIAbstractItemModel *>()( m, other.m ) ) ) ) ) );
79 };
80private:
81 inline CFxUIModelIndex( int arow, int acolumn, void *ptr, const CFxUIAbstractItemModel *amodel )
82 : r( arow ), c( acolumn ), i( reinterpret_cast< quintptr >( ptr ) ), m( amodel )
83 {
84 };
85 inline CFxUIModelIndex( int arow, int acolumn, quintptr id, const CFxUIAbstractItemModel *amodel )
86 : r( arow ), c( acolumn ), i( id ), m( amodel )
87 {
88 };
89
90 int r, c;
91 qintptr i;
93};
#define COMMONUI_API
QVariant CFxUIVariant
Definition: FxUIObject.h:52
bool isValid() const
bool operator!=(const CFxUIModelIndex &other) const
int row() const
const CFxUIAbstractItemModel * model() const
int column() const
bool operator==(const CFxUIModelIndex &other) const
quintptr internalId() const
bool operator<(const CFxUIModelIndex &other) const
void * internalPointer() const
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110