1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
/***************************************************************************
valuecolumninterface.h - description
-------------------
begin : Fri Sep 12 2003
copyright : (C) 2003 by Friedrich W. H. Kossebau
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License version 2 as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef VALUECOLUMNINTERFACE_H
#define VALUECOLUMNINTERFACE_H
namespace KHE
{
/**
* Interface for the value displaying column of a hexedit widget
*
* @author Friedrich W. H. Kossebau <[email protected]>
* @see createBytesEditWidget(), valueColumnInterface()
* @since 3.2
*/
class ValueColumnInterface
{
public:
/** collection of ids for the different numeric codings of a byte */
enum KCoding
{
/** hexadecimal encoding */
HexadecimalCoding=0,
/** decimal encoding */
DecimalCoding=1,
/** octal encoding */
OctalCoding=2,
/** bit by bit coding */
BinaryCoding=3,
/** @internal enables extension without breaking binary compatibility */
MaxCodingId=0xFFFF
};
/** collection of ids for the fitting of the layout into the available widget's width */
enum KResizeStyle
{
/** we don't care about the actual sizing of the widget
* but stick to the given NoOfBytesPerLine
*/
NoResize=0,
/** we try to fit the layout to the available width
* but only with full groups like set in NoOfGroupedBytes
* with minimum of one full group
*/
LockGrouping=1,
/** we try to fit as many bytes into the width as possible, with minimum of 1 byte
*/
FullSizeUsage=2,
/** @internal enables extension without breaking binary compatibility */
MaxResizeStyleId=0xFF
};
public: // get methods
/** @return the current resize style
* @see setResizeStyle()
*/
virtual KResizeStyle resizeStyle() const = 0;
/** @return the current number of bytes per line
* @see setNoOfBytesPerLine()
*/
virtual int noOfBytesPerLine() const = 0;
/** @return the current coding
* @see setCoding()
*/
virtual KCoding coding() const = 0;
/** @return the spacing between bytes (in pixels)
* @see setByteSpacingWidth()
*/
virtual int byteSpacingWidth() const = 0;
/** @return the current number of bytes per group
* @see setNoOfGroupedBytes()
*/
virtual int noOfGroupedBytes() const = 0;
/** @return the spacing between groups of bytes (in pixels)
* @see setGroupSpacingWidth()
*/
virtual int groupSpacingWidth() const = 0;
/** @return the gap in the middle of a binary (in pixels)
* @see setBinaryGapWidth()
*/
virtual int binaryGapWidth() const = 0;
public: // set methods
/** sets the resize style for the hex column.
* Default is @c FullSizeUsage
* @param Style new style
* @see resizeStyle()
*/
virtual void setResizeStyle( KResizeStyle Style ) = 0;
/** sets the number of bytes per line, switching the resize style to @c NoResize
* Default is 16.
* @param NoCpL new number of bytes per line
* @see noOfBytesPerLine()
*/
virtual void setNoOfBytesPerLine( int NoCpL ) = 0;
/** sets the format of the hex column.
* If the coding is not available the format will not be changed.
* Default is @c HexadecimalCoding.
* @param C
* @see coding()
*/
virtual void setCoding( KCoding C ) = 0;
/** sets the spacing between the bytes.
* Default is 3.
* @param BSW new spacing between bytes (in pixels)
* @see byteSpacingWidth()
*/
virtual void setByteSpacingWidth( int BSW ) = 0;
/** sets the numbers of grouped bytes, 0 means no grouping.
* Default is 4.
* @param NoGB new number of bytes per group
* @see noOfGroupedBytes()
*/
virtual void setNoOfGroupedBytes( int NoGB ) = 0;
/** sets the spacing between the groups.
* Default is 9.
* @param GSW new spacing width (in pixels)
* @see groupSpacingWidth()
*/
virtual void setGroupSpacingWidth( int GSW ) = 0;
/** sets the spacing in the middle of a binary encoded byte.
* Default is 1.
* @param BGW spacing in the middle of a binary (in pixels)
* @see binaryGapWidth()
*/
virtual void setBinaryGapWidth( int BGW ) = 0;
};
/** tries to get the valuecolumn interface of t
* @return a pointer to the interface, otherwise 0
* @author Friedrich W. H. Kossebau <[email protected]>
* @since 3.2
*/
template<class T>
ValueColumnInterface *valueColumnInterface( T *t )
{
if( !t )
return 0;
return dynamic_cast<KHE::ValueColumnInterface*>( t );
}
}
#endif
|