Merge in from trunk r67662 to r64801
[wxWidgets.git] / include / wx / listbase.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/listbase.h
3 // Purpose: wxListCtrl class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 04.12.99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_LISTBASE_H_BASE_
13 #define _WX_LISTBASE_H_BASE_
14
15 #include "wx/colour.h"
16 #include "wx/font.h"
17 #include "wx/gdicmn.h"
18 #include "wx/event.h"
19
20 // ----------------------------------------------------------------------------
21 // types
22 // ----------------------------------------------------------------------------
23
24 // type of compare function for wxListCtrl sort operation
25 typedef
26 int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData);
27
28 // ----------------------------------------------------------------------------
29 // wxListCtrl constants
30 // ----------------------------------------------------------------------------
31
32 // style flags
33 #define wxLC_VRULES 0x0001
34 #define wxLC_HRULES 0x0002
35
36 #define wxLC_ICON 0x0004
37 #define wxLC_SMALL_ICON 0x0008
38 #define wxLC_LIST 0x0010
39 #define wxLC_REPORT 0x0020
40
41 #define wxLC_ALIGN_TOP 0x0040
42 #define wxLC_ALIGN_LEFT 0x0080
43 #define wxLC_AUTOARRANGE 0x0100
44 #define wxLC_VIRTUAL 0x0200
45 #define wxLC_EDIT_LABELS 0x0400
46 #define wxLC_NO_HEADER 0x0800
47 #define wxLC_NO_SORT_HEADER 0x1000
48 #define wxLC_SINGLE_SEL 0x2000
49 #define wxLC_SORT_ASCENDING 0x4000
50 #define wxLC_SORT_DESCENDING 0x8000
51
52 #define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
53 #define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
54 #define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
55
56 // for compatibility only
57 #define wxLC_USER_TEXT wxLC_VIRTUAL
58
59 // Omitted because
60 // (a) too much detail
61 // (b) not enough style flags
62 // (c) not implemented anyhow in the generic version
63 //
64 // #define wxLC_NO_SCROLL
65 // #define wxLC_NO_LABEL_WRAP
66 // #define wxLC_OWNERDRAW_FIXED
67 // #define wxLC_SHOW_SEL_ALWAYS
68
69 // Mask flags to tell app/GUI what fields of wxListItem are valid
70 #define wxLIST_MASK_STATE 0x0001
71 #define wxLIST_MASK_TEXT 0x0002
72 #define wxLIST_MASK_IMAGE 0x0004
73 #define wxLIST_MASK_DATA 0x0008
74 #define wxLIST_SET_ITEM 0x0010
75 #define wxLIST_MASK_WIDTH 0x0020
76 #define wxLIST_MASK_FORMAT 0x0040
77
78 // State flags for indicating the state of an item
79 #define wxLIST_STATE_DONTCARE 0x0000
80 #define wxLIST_STATE_DROPHILITED 0x0001 // MSW only
81 #define wxLIST_STATE_FOCUSED 0x0002
82 #define wxLIST_STATE_SELECTED 0x0004
83 #define wxLIST_STATE_CUT 0x0008 // MSW only
84 #define wxLIST_STATE_DISABLED 0x0010 // OS2 only
85 #define wxLIST_STATE_FILTERED 0x0020 // OS2 only
86 #define wxLIST_STATE_INUSE 0x0040 // OS2 only
87 #define wxLIST_STATE_PICKED 0x0080 // OS2 only
88 #define wxLIST_STATE_SOURCE 0x0100 // OS2 only
89
90 // Hit test flags, used in HitTest
91 #define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
92 #define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
93 #define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
94 #define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
95 #define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
96 #define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
97 #define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
98 #define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area.
99 #define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area.
100
101 #define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
102
103 // GetSubItemRect constants
104 #define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l
105
106 // Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL)
107 enum
108 {
109 wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
110 wxLIST_NEXT_ALL, // Searches for subsequent item by index
111 wxLIST_NEXT_BELOW, // Searches for an item below the specified item
112 wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
113 wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
114 };
115
116 // Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT)
117 enum
118 {
119 wxLIST_ALIGN_DEFAULT,
120 wxLIST_ALIGN_LEFT,
121 wxLIST_ALIGN_TOP,
122 wxLIST_ALIGN_SNAP_TO_GRID
123 };
124
125 // Column format (MSW only except wxLIST_FORMAT_LEFT)
126 enum wxListColumnFormat
127 {
128 wxLIST_FORMAT_LEFT,
129 wxLIST_FORMAT_RIGHT,
130 wxLIST_FORMAT_CENTRE,
131 wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
132 };
133
134 // Autosize values for SetColumnWidth
135 enum
136 {
137 wxLIST_AUTOSIZE = -1,
138 wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version
139 };
140
141 // Flag values for GetItemRect
142 enum
143 {
144 wxLIST_RECT_BOUNDS,
145 wxLIST_RECT_ICON,
146 wxLIST_RECT_LABEL
147 };
148
149 // Flag values for FindItem (MSW only)
150 enum
151 {
152 wxLIST_FIND_UP,
153 wxLIST_FIND_DOWN,
154 wxLIST_FIND_LEFT,
155 wxLIST_FIND_RIGHT
156 };
157
158 // ----------------------------------------------------------------------------
159 // wxListItemAttr: a structure containing the visual attributes of an item
160 // ----------------------------------------------------------------------------
161
162 // TODO: this should be renamed to wxItemAttr or something general like this
163 // and used as base class for wxTextAttr which duplicates this class
164 // entirely currently
165 class WXDLLIMPEXP_CORE wxListItemAttr
166 {
167 public:
168 // ctors
169 wxListItemAttr() { }
170 wxListItemAttr(const wxColour& colText,
171 const wxColour& colBack,
172 const wxFont& font)
173 : m_colText(colText), m_colBack(colBack), m_font(font)
174 {
175 }
176
177 // default copy ctor, assignment operator and dtor are ok
178
179
180 // setters
181 void SetTextColour(const wxColour& colText) { m_colText = colText; }
182 void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
183 void SetFont(const wxFont& font) { m_font = font; }
184
185 // accessors
186 bool HasTextColour() const { return m_colText.IsOk(); }
187 bool HasBackgroundColour() const { return m_colBack.IsOk(); }
188 bool HasFont() const { return m_font.IsOk(); }
189
190 const wxColour& GetTextColour() const { return m_colText; }
191 const wxColour& GetBackgroundColour() const { return m_colBack; }
192 const wxFont& GetFont() const { return m_font; }
193
194
195 // this is almost like assignment operator except it doesn't overwrite the
196 // fields unset in the source attribute
197 void AssignFrom(const wxListItemAttr& source)
198 {
199 if ( source.HasTextColour() )
200 SetTextColour(source.GetTextColour());
201 if ( source.HasBackgroundColour() )
202 SetBackgroundColour(source.GetBackgroundColour());
203 if ( source.HasFont() )
204 SetFont(source.GetFont());
205 }
206
207 private:
208 wxColour m_colText,
209 m_colBack;
210 wxFont m_font;
211 };
212
213 // ----------------------------------------------------------------------------
214 // wxListItem: the item or column info, used to exchange data with wxListCtrl
215 // ----------------------------------------------------------------------------
216
217 class WXDLLIMPEXP_CORE wxListItem : public wxObject
218 {
219 public:
220 wxListItem() { Init(); m_attr = NULL; }
221 wxListItem(const wxListItem& item)
222 : wxObject(),
223 m_mask(item.m_mask),
224 m_itemId(item.m_itemId),
225 m_col(item.m_col),
226 m_state(item.m_state),
227 m_stateMask(item.m_stateMask),
228 m_text(item.m_text),
229 m_image(item.m_image),
230 m_data(item.m_data),
231 m_format(item.m_format),
232 m_width(item.m_width),
233 m_attr(NULL)
234 {
235 // copy list item attributes
236 if ( item.HasAttributes() )
237 m_attr = new wxListItemAttr(*item.GetAttributes());
238 }
239
240 wxListItem& operator=(const wxListItem& item)
241 {
242 if ( &item != this )
243 {
244 m_mask = item.m_mask;
245 m_itemId = item.m_itemId;
246 m_col = item.m_col;
247 m_state = item.m_state;
248 m_stateMask = item.m_stateMask;
249 m_text = item.m_text;
250 m_image = item.m_image;
251 m_data = item.m_data;
252 m_format = item.m_format;
253 m_width = item.m_width;
254 m_attr = item.m_attr ? new wxListItemAttr(*item.m_attr) : NULL;
255 }
256
257 return *this;
258 }
259
260 virtual ~wxListItem() { delete m_attr; }
261
262 // resetting
263 void Clear() { Init(); m_text.clear(); ClearAttributes(); }
264 void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } }
265
266 // setters
267 void SetMask(long mask)
268 { m_mask = mask; }
269 void SetId(long id)
270 { m_itemId = id; }
271 void SetColumn(int col)
272 { m_col = col; }
273 void SetState(long state)
274 { m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; }
275 void SetStateMask(long stateMask)
276 { m_stateMask = stateMask; }
277 void SetText(const wxString& text)
278 { m_mask |= wxLIST_MASK_TEXT; m_text = text; }
279 void SetImage(int image)
280 { m_mask |= wxLIST_MASK_IMAGE; m_image = image; }
281 void SetData(long data)
282 { m_mask |= wxLIST_MASK_DATA; m_data = data; }
283 void SetData(void *data)
284 { m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); }
285
286 void SetWidth(int width)
287 { m_mask |= wxLIST_MASK_WIDTH; m_width = width; }
288 void SetAlign(wxListColumnFormat align)
289 { m_mask |= wxLIST_MASK_FORMAT; m_format = align; }
290
291 void SetTextColour(const wxColour& colText)
292 { Attributes().SetTextColour(colText); }
293 void SetBackgroundColour(const wxColour& colBack)
294 { Attributes().SetBackgroundColour(colBack); }
295 void SetFont(const wxFont& font)
296 { Attributes().SetFont(font); }
297
298 // accessors
299 long GetMask() const { return m_mask; }
300 long GetId() const { return m_itemId; }
301 int GetColumn() const { return m_col; }
302 long GetState() const { return m_state & m_stateMask; }
303 const wxString& GetText() const { return m_text; }
304 int GetImage() const { return m_image; }
305 wxUIntPtr GetData() const { return m_data; }
306
307 int GetWidth() const { return m_width; }
308 wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; }
309
310 wxListItemAttr *GetAttributes() const { return m_attr; }
311 bool HasAttributes() const { return m_attr != NULL; }
312
313 wxColour GetTextColour() const
314 { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; }
315 wxColour GetBackgroundColour() const
316 { return HasAttributes() ? m_attr->GetBackgroundColour()
317 : wxNullColour; }
318 wxFont GetFont() const
319 { return HasAttributes() ? m_attr->GetFont() : wxNullFont; }
320
321 // this conversion is necessary to make old code using GetItem() to
322 // compile
323 operator long() const { return m_itemId; }
324
325 // these members are public for compatibility
326
327 long m_mask; // Indicates what fields are valid
328 long m_itemId; // The zero-based item position
329 int m_col; // Zero-based column, if in report mode
330 long m_state; // The state of the item
331 long m_stateMask;// Which flags of m_state are valid (uses same flags)
332 wxString m_text; // The label/header text
333 int m_image; // The zero-based index into an image list
334 wxUIntPtr m_data; // App-defined data
335
336 // For columns only
337 int m_format; // left, right, centre
338 int m_width; // width of column
339
340 #ifdef __WXPM__
341 int m_miniImage; // handle to the mini image for OS/2
342 #endif
343
344 protected:
345 // creates m_attr if we don't have it yet
346 wxListItemAttr& Attributes()
347 {
348 if ( !m_attr )
349 m_attr = new wxListItemAttr;
350
351 return *m_attr;
352 }
353
354 void Init()
355 {
356 m_mask = 0;
357 m_itemId = 0;
358 m_col = 0;
359 m_state = 0;
360 m_stateMask = 0;
361 m_image = -1;
362 m_data = 0;
363
364 m_format = wxLIST_FORMAT_CENTRE;
365 m_width = 0;
366 }
367
368 wxListItemAttr *m_attr; // optional pointer to the items style
369
370 private:
371 DECLARE_DYNAMIC_CLASS(wxListItem)
372 };
373
374 // ----------------------------------------------------------------------------
375 // wxListEvent - the event class for the wxListCtrl notifications
376 // ----------------------------------------------------------------------------
377
378 class WXDLLIMPEXP_CORE wxListEvent : public wxNotifyEvent
379 {
380 public:
381 wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
382 : wxNotifyEvent(commandType, winid)
383 , m_code(-1)
384 , m_oldItemIndex(-1)
385 , m_itemIndex(-1)
386 , m_col(-1)
387 , m_pointDrag()
388 , m_item()
389 , m_editCancelled(false)
390 { }
391
392 wxListEvent(const wxListEvent& event)
393 : wxNotifyEvent(event)
394 , m_code(event.m_code)
395 , m_oldItemIndex(event.m_oldItemIndex)
396 , m_itemIndex(event.m_itemIndex)
397 , m_col(event.m_col)
398 , m_pointDrag(event.m_pointDrag)
399 , m_item(event.m_item)
400 , m_editCancelled(event.m_editCancelled)
401 { }
402
403 int GetKeyCode() const { return m_code; }
404 long GetIndex() const { return m_itemIndex; }
405 int GetColumn() const { return m_col; }
406 wxPoint GetPoint() const { return m_pointDrag; }
407 const wxString& GetLabel() const { return m_item.m_text; }
408 const wxString& GetText() const { return m_item.m_text; }
409 int GetImage() const { return m_item.m_image; }
410 long GetData() const { return static_cast<long>(m_item.m_data); }
411 long GetMask() const { return m_item.m_mask; }
412 const wxListItem& GetItem() const { return m_item; }
413
414 // for wxEVT_COMMAND_LIST_CACHE_HINT only
415 long GetCacheFrom() const { return m_oldItemIndex; }
416 long GetCacheTo() const { return m_itemIndex; }
417
418 // was label editing canceled? (for wxEVT_COMMAND_LIST_END_LABEL_EDIT only)
419 bool IsEditCancelled() const { return m_editCancelled; }
420 void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; }
421
422 virtual wxEvent *Clone() const { return new wxListEvent(*this); }
423
424 //protected: -- not for backwards compatibility
425 int m_code;
426 long m_oldItemIndex; // only for wxEVT_COMMAND_LIST_CACHE_HINT
427 long m_itemIndex;
428 int m_col;
429 wxPoint m_pointDrag;
430
431 wxListItem m_item;
432
433 protected:
434 bool m_editCancelled;
435
436 private:
437 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent)
438 };
439
440 // ----------------------------------------------------------------------------
441 // wxListCtrl event macros
442 // ----------------------------------------------------------------------------
443
444 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_DRAG, wxListEvent );
445 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_RDRAG, wxListEvent );
446 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, wxListEvent );
447 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEvent );
448 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_DELETE_ITEM, wxListEvent );
449 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, wxListEvent );
450
451 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEvent );
452 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEvent );
453 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_KEY_DOWN, wxListEvent );
454 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_INSERT_ITEM, wxListEvent );
455 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_CLICK, wxListEvent );
456 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEvent );
457 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, wxListEvent );
458 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEvent );
459 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_CACHE_HINT, wxListEvent );
460 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, wxListEvent );
461 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEvent );
462 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_DRAGGING, wxListEvent );
463 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_END_DRAG, wxListEvent );
464 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_FOCUSED, wxListEvent );
465
466 typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
467
468 #define wxListEventHandler(func) \
469 wxEVENT_HANDLER_CAST(wxListEventFunction, func)
470
471 #define wx__DECLARE_LISTEVT(evt, id, fn) \
472 wx__DECLARE_EVT1(wxEVT_COMMAND_LIST_ ## evt, id, wxListEventHandler(fn))
473
474 #define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn)
475 #define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn)
476 #define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn)
477 #define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn)
478 #define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn)
479 #define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn)
480 #define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn)
481 #define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn)
482
483 #define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn)
484 #define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn)
485 #define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn)
486 #define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn)
487 #define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn)
488
489 #define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn)
490 #define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn)
491 #define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn)
492 #define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn)
493 #define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn)
494 #define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn)
495
496 #define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn)
497
498
499 #endif
500 // _WX_LISTCTRL_H_BASE_