]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/private/listctrl.h
don't draw borders for bitmap buttons with wxBORDER_NONE style
[wxWidgets.git] / include / wx / generic / private / listctrl.h
CommitLineData
ad486020
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: listctrl.h
3// Purpose: private definitions of wxListCtrl helpers
4// Author: Robert Roebling
5// Vadim Zeitlin (virtual list control support)
6// Id: $Id$
7// Copyright: (c) 1998 Robert Roebling
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_GENERIC_LISTCTRL_PRIVATE_H_
12#define _WX_GENERIC_LISTCTRL_PRIVATE_H_
13
14#include "wx/defs.h"
15
16#if wxUSE_LISTCTRL
17
18#include "wx/listctrl.h"
19#include "wx/selstore.h"
4d833b7b
VZ
20#include "wx/timer.h"
21#include "wx/settings.h"
ad486020
FM
22
23// ============================================================================
24// private classes
25// ============================================================================
26
27//-----------------------------------------------------------------------------
28// wxColWidthInfo (internal)
29//-----------------------------------------------------------------------------
30
31struct wxColWidthInfo
32{
33 int nMaxWidth;
34 bool bNeedsUpdate; // only set to true when an item whose
35 // width == nMaxWidth is removed
36
37 wxColWidthInfo(int w = 0, bool needsUpdate = false)
38 {
39 nMaxWidth = w;
40 bNeedsUpdate = needsUpdate;
41 }
42};
43
44WX_DEFINE_ARRAY_PTR(wxColWidthInfo *, ColWidthArray);
45
46//-----------------------------------------------------------------------------
47// wxListItemData (internal)
48//-----------------------------------------------------------------------------
49
50class wxListItemData
51{
52public:
53 wxListItemData(wxListMainWindow *owner);
54 ~wxListItemData();
55
56 void SetItem( const wxListItem &info );
57 void SetImage( int image ) { m_image = image; }
58 void SetData( wxUIntPtr data ) { m_data = data; }
59 void SetPosition( int x, int y );
60 void SetSize( int width, int height );
61
62 bool HasText() const { return !m_text.empty(); }
63 const wxString& GetText() const { return m_text; }
64 void SetText(const wxString& text) { m_text = text; }
65
66 // we can't use empty string for measuring the string width/height, so
67 // always return something
68 wxString GetTextForMeasuring() const
69 {
70 wxString s = GetText();
71 if ( s.empty() )
72 s = _T('H');
73
74 return s;
75 }
76
77 bool IsHit( int x, int y ) const;
78
79 int GetX() const;
80 int GetY() const;
81 int GetWidth() const;
82 int GetHeight() const;
83
84 int GetImage() const { return m_image; }
85 bool HasImage() const { return GetImage() != -1; }
86
87 void GetItem( wxListItem &info ) const;
88
89 void SetAttr(wxListItemAttr *attr) { m_attr = attr; }
90 wxListItemAttr *GetAttr() const { return m_attr; }
91
92public:
93 // the item image or -1
94 int m_image;
95
96 // user data associated with the item
97 wxUIntPtr m_data;
98
99 // the item coordinates are not used in report mode; instead this pointer is
100 // NULL and the owner window is used to retrieve the item position and size
101 wxRect *m_rect;
102
103 // the list ctrl we are in
104 wxListMainWindow *m_owner;
105
106 // custom attributes or NULL
107 wxListItemAttr *m_attr;
108
109protected:
110 // common part of all ctors
111 void Init();
112
113 wxString m_text;
114};
115
116//-----------------------------------------------------------------------------
117// wxListHeaderData (internal)
118//-----------------------------------------------------------------------------
119
120class wxListHeaderData : public wxObject
121{
122public:
123 wxListHeaderData();
124 wxListHeaderData( const wxListItem &info );
125 void SetItem( const wxListItem &item );
126 void SetPosition( int x, int y );
127 void SetWidth( int w );
128 void SetState( int state );
129 void SetFormat( int format );
130 void SetHeight( int h );
131 bool HasImage() const;
132
133 bool HasText() const { return !m_text.empty(); }
134 const wxString& GetText() const { return m_text; }
135 void SetText(const wxString& text) { m_text = text; }
136
137 void GetItem( wxListItem &item );
138
139 bool IsHit( int x, int y ) const;
140 int GetImage() const;
141 int GetWidth() const;
142 int GetFormat() const;
143 int GetState() const;
144
145protected:
146 long m_mask;
147 int m_image;
148 wxString m_text;
149 int m_format;
150 int m_width;
151 int m_xpos,
152 m_ypos;
153 int m_height;
154 int m_state;
155
156private:
157 void Init();
158};
159
160//-----------------------------------------------------------------------------
161// wxListLineData (internal)
162//-----------------------------------------------------------------------------
163
164WX_DECLARE_LIST(wxListItemData, wxListItemDataList);
165
166class wxListLineData
167{
168public:
169 // the list of subitems: only may have more than one item in report mode
170 wxListItemDataList m_items;
171
172 // this is not used in report view
173 struct GeometryInfo
174 {
175 // total item rect
176 wxRect m_rectAll;
177
178 // label only
179 wxRect m_rectLabel;
180
181 // icon only
182 wxRect m_rectIcon;
183
184 // the part to be highlighted
185 wxRect m_rectHighlight;
186
187 // extend all our rects to be centered inside the one of given width
188 void ExtendWidth(wxCoord w)
189 {
190 wxASSERT_MSG( m_rectAll.width <= w,
191 _T("width can only be increased") );
192
193 m_rectAll.width = w;
194 m_rectLabel.x = m_rectAll.x + (w - m_rectLabel.width) / 2;
195 m_rectIcon.x = m_rectAll.x + (w - m_rectIcon.width) / 2;
196 m_rectHighlight.x = m_rectAll.x + (w - m_rectHighlight.width) / 2;
197 }
198 }
199 *m_gi;
200
201 // is this item selected? [NB: not used in virtual mode]
202 bool m_highlighted;
203
204 // back pointer to the list ctrl
205 wxListMainWindow *m_owner;
206
207public:
208 wxListLineData(wxListMainWindow *owner);
209
210 ~wxListLineData()
211 {
212 WX_CLEAR_LIST(wxListItemDataList, m_items);
213 delete m_gi;
214 }
215
216 // are we in report mode?
217 inline bool InReportView() const;
218
219 // are we in virtual report mode?
220 inline bool IsVirtual() const;
221
222 // these 2 methods shouldn't be called for report view controls, in that
223 // case we determine our position/size ourselves
224
225 // calculate the size of the line
226 void CalculateSize( wxDC *dc, int spacing );
227
228 // remember the position this line appears at
229 void SetPosition( int x, int y, int spacing );
230
231 // wxListCtrl API
232
233 void SetImage( int image ) { SetImage(0, image); }
234 int GetImage() const { return GetImage(0); }
235 void SetImage( int index, int image );
236 int GetImage( int index ) const;
237
238 bool HasImage() const { return GetImage() != -1; }
239 bool HasText() const { return !GetText(0).empty(); }
240
241 void SetItem( int index, const wxListItem &info );
242 void GetItem( int index, wxListItem &info );
243
244 wxString GetText(int index) const;
245 void SetText( int index, const wxString& s );
246
247 wxListItemAttr *GetAttr() const;
248 void SetAttr(wxListItemAttr *attr);
249
250 // return true if the highlighting really changed
251 bool Highlight( bool on );
252
253 void ReverseHighlight();
254
255 bool IsHighlighted() const
256 {
257 wxASSERT_MSG( !IsVirtual(), _T("unexpected call to IsHighlighted") );
258
259 return m_highlighted;
260 }
261
262 // draw the line on the given DC in icon/list mode
263 void Draw( wxDC *dc );
264
265 // the same in report mode
266 void DrawInReportMode( wxDC *dc,
267 const wxRect& rect,
268 const wxRect& rectHL,
269 bool highlighted,
270 bool current );
271
272private:
273 // set the line to contain num items (only can be > 1 in report mode)
274 void InitItems( int num );
275
276 // get the mode (i.e. style) of the list control
277 inline int GetMode() const;
278
279 // prepare the DC for drawing with these item's attributes, return true if
280 // we need to draw the items background to highlight it, false otherwise
281 bool SetAttributes(wxDC *dc,
282 const wxListItemAttr *attr,
283 bool highlight);
284
285 // draw the text on the DC with the correct justification; also add an
286 // ellipsis if the text is too large to fit in the current width
287 void DrawTextFormatted(wxDC *dc,
288 const wxString &text,
289 int col,
290 int x,
291 int yMid, // this is middle, not top, of the text
292 int width);
293};
294
295WX_DECLARE_OBJARRAY(wxListLineData, wxListLineDataArray);
296
297//-----------------------------------------------------------------------------
298// wxListHeaderWindow (internal)
299//-----------------------------------------------------------------------------
300
301class wxListHeaderWindow : public wxWindow
302{
303protected:
304 wxListMainWindow *m_owner;
305 const wxCursor *m_currentCursor;
306 wxCursor *m_resizeCursor;
307 bool m_isDragging;
308
309 // column being resized or -1
310 int m_column;
311
312 // divider line position in logical (unscrolled) coords
313 int m_currentX;
314
315 // minimal position beyond which the divider line
316 // can't be dragged in logical coords
317 int m_minX;
318
319public:
320 wxListHeaderWindow();
321
322 wxListHeaderWindow( wxWindow *win,
323 wxWindowID id,
324 wxListMainWindow *owner,
325 const wxPoint &pos = wxDefaultPosition,
326 const wxSize &size = wxDefaultSize,
327 long style = 0,
328 const wxString &name = wxT("wxlistctrlcolumntitles") );
329
330 virtual ~wxListHeaderWindow();
331
332 void DrawCurrent();
333 void AdjustDC( wxDC& dc );
334
335 void OnPaint( wxPaintEvent &event );
336 void OnMouse( wxMouseEvent &event );
337 void OnSetFocus( wxFocusEvent &event );
338
339 // needs refresh
340 bool m_dirty;
341
342 // Update main window's column later
343 bool m_sendSetColumnWidth;
344 int m_colToSend;
345 int m_widthToSend;
346
347 virtual void OnInternalIdle();
348
349private:
350 // common part of all ctors
351 void Init();
352
353 // generate and process the list event of the given type, return true if
354 // it wasn't vetoed, i.e. if we should proceed
355 bool SendListEvent(wxEventType type, const wxPoint& pos);
356
357 DECLARE_EVENT_TABLE()
358};
359
360//-----------------------------------------------------------------------------
361// wxListRenameTimer (internal)
362//-----------------------------------------------------------------------------
363
364class wxListRenameTimer: public wxTimer
365{
366private:
367 wxListMainWindow *m_owner;
368
369public:
370 wxListRenameTimer( wxListMainWindow *owner );
371 void Notify();
372};
373
374//-----------------------------------------------------------------------------
375// wxListTextCtrlWrapper: wraps a wxTextCtrl to make it work for inline editing
376//-----------------------------------------------------------------------------
377
378class wxListTextCtrlWrapper : public wxEvtHandler
379{
380public:
381 // NB: text must be a valid object but not Create()d yet
382 wxListTextCtrlWrapper(wxListMainWindow *owner,
383 wxTextCtrl *text,
384 size_t itemEdit);
385
386 wxTextCtrl *GetText() const { return m_text; }
387
388 void EndEdit( bool discardChanges );
389
390protected:
391 void OnChar( wxKeyEvent &event );
392 void OnKeyUp( wxKeyEvent &event );
393 void OnKillFocus( wxFocusEvent &event );
394
395 bool AcceptChanges();
396 void Finish( bool setfocus );
397
398private:
399 wxListMainWindow *m_owner;
400 wxTextCtrl *m_text;
401 wxString m_startValue;
402 size_t m_itemEdited;
403 bool m_aboutToFinish;
404
405 DECLARE_EVENT_TABLE()
406};
407
408//-----------------------------------------------------------------------------
409// wxListMainWindow (internal)
410//-----------------------------------------------------------------------------
411
412WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList);
413
414class wxListMainWindow : public wxWindow
415{
416public:
417 wxListMainWindow();
418 wxListMainWindow( wxWindow *parent,
419 wxWindowID id,
420 const wxPoint& pos = wxDefaultPosition,
421 const wxSize& size = wxDefaultSize,
422 long style = 0,
423 const wxString &name = _T("listctrlmainwindow") );
424
425 virtual ~wxListMainWindow();
426
427 bool HasFlag(int flag) const { return m_parent->HasFlag(flag); }
428
429 // return true if this is a virtual list control
430 bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
431
432 // return true if the control is in report mode
433 bool InReportView() const { return HasFlag(wxLC_REPORT); }
434
435 // return true if we are in single selection mode, false if multi sel
436 bool IsSingleSel() const { return HasFlag(wxLC_SINGLE_SEL); }
437
438 // do we have a header window?
439 bool HasHeader() const
440 { return InReportView() && !HasFlag(wxLC_NO_HEADER); }
441
442 void HighlightAll( bool on );
443
444 // all these functions only do something if the line is currently visible
445
446 // change the line "selected" state, return true if it really changed
447 bool HighlightLine( size_t line, bool highlight = true);
448
449 // as HighlightLine() but do it for the range of lines: this is incredibly
450 // more efficient for virtual list controls!
451 //
452 // NB: unlike HighlightLine() this one does refresh the lines on screen
453 void HighlightLines( size_t lineFrom, size_t lineTo, bool on = true );
454
455 // toggle the line state and refresh it
456 void ReverseHighlight( size_t line )
457 { HighlightLine(line, !IsHighlighted(line)); RefreshLine(line); }
458
459 // return true if the line is highlighted
460 bool IsHighlighted(size_t line) const;
461
462 // refresh one or several lines at once
463 void RefreshLine( size_t line );
464 void RefreshLines( size_t lineFrom, size_t lineTo );
465
466 // refresh all selected items
467 void RefreshSelected();
468
469 // refresh all lines below the given one: the difference with
470 // RefreshLines() is that the index here might not be a valid one (happens
471 // when the last line is deleted)
472 void RefreshAfter( size_t lineFrom );
473
474 // the methods which are forwarded to wxListLineData itself in list/icon
475 // modes but are here because the lines don't store their positions in the
476 // report mode
477
478 // get the bound rect for the entire line
479 wxRect GetLineRect(size_t line) const;
480
481 // get the bound rect of the label
482 wxRect GetLineLabelRect(size_t line) const;
483
484 // get the bound rect of the items icon (only may be called if we do have
485 // an icon!)
486 wxRect GetLineIconRect(size_t line) const;
487
488 // get the rect to be highlighted when the item has focus
489 wxRect GetLineHighlightRect(size_t line) const;
490
491 // get the size of the total line rect
492 wxSize GetLineSize(size_t line) const
493 { return GetLineRect(line).GetSize(); }
494
495 // return the hit code for the corresponding position (in this line)
496 long HitTestLine(size_t line, int x, int y) const;
497
498 // bring the selected item into view, scrolling to it if necessary
499 void MoveToItem(size_t item);
500
501 bool ScrollList( int WXUNUSED(dx), int dy );
502
503 // bring the current item into view
504 void MoveToFocus() { MoveToItem(m_current); }
505
506 // start editing the label of the given item
507 wxTextCtrl *EditLabel(long item,
508 wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl));
509 wxTextCtrl *GetEditControl() const
510 {
511 return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL;
512 }
513
514 void ResetTextControl(wxTextCtrl *text)
515 {
516 delete text;
517 m_textctrlWrapper = NULL;
518 }
519
520 void OnRenameTimer();
521 bool OnRenameAccept(size_t itemEdit, const wxString& value);
522 void OnRenameCancelled(size_t itemEdit);
523
524 void OnMouse( wxMouseEvent &event );
525
526 // called to switch the selection from the current item to newCurrent,
527 void OnArrowChar( size_t newCurrent, const wxKeyEvent& event );
528
529 void OnChar( wxKeyEvent &event );
530 void OnKeyDown( wxKeyEvent &event );
531 void OnKeyUp( wxKeyEvent &event );
532 void OnSetFocus( wxFocusEvent &event );
533 void OnKillFocus( wxFocusEvent &event );
534 void OnScroll( wxScrollWinEvent& event );
535
536 void OnPaint( wxPaintEvent &event );
537
538 void OnChildFocus(wxChildFocusEvent& event);
539
540 void DrawImage( int index, wxDC *dc, int x, int y );
541 void GetImageSize( int index, int &width, int &height ) const;
542 int GetTextLength( const wxString &s ) const;
543
544 void SetImageList( wxImageList *imageList, int which );
545 void SetItemSpacing( int spacing, bool isSmall = false );
546 int GetItemSpacing( bool isSmall = false );
547
548 void SetColumn( int col, wxListItem &item );
549 void SetColumnWidth( int col, int width );
550 void GetColumn( int col, wxListItem &item ) const;
551 int GetColumnWidth( int col ) const;
552 int GetColumnCount() const { return m_columns.GetCount(); }
553
554 // returns the sum of the heights of all columns
555 int GetHeaderWidth() const;
556
557 int GetCountPerPage() const;
558
559 void SetItem( wxListItem &item );
560 void GetItem( wxListItem &item ) const;
561 void SetItemState( long item, long state, long stateMask );
562 void SetItemStateAll( long state, long stateMask );
563 int GetItemState( long item, long stateMask ) const;
564 bool GetItemRect( long item, wxRect &rect ) const
565 {
566 return GetSubItemRect(item, wxLIST_GETSUBITEMRECT_WHOLEITEM, rect);
567 }
568 bool GetSubItemRect( long item, long subItem, wxRect& rect ) const;
569 wxRect GetViewRect() const;
570 bool GetItemPosition( long item, wxPoint& pos ) const;
571 int GetSelectedItemCount() const;
572
573 wxString GetItemText(long item) const
574 {
575 wxListItem info;
576 info.m_mask = wxLIST_MASK_TEXT;
577 info.m_itemId = item;
578 GetItem( info );
579 return info.m_text;
580 }
581
582 void SetItemText(long item, const wxString& value)
583 {
584 wxListItem info;
585 info.m_mask = wxLIST_MASK_TEXT;
586 info.m_itemId = item;
587 info.m_text = value;
588 SetItem( info );
589 }
590
591 wxImageList* GetSmallImageList() const
592 { return m_small_image_list; }
593
594 // set the scrollbars and update the positions of the items
595 void RecalculatePositions(bool noRefresh = false);
596
597 // refresh the window and the header
598 void RefreshAll();
599
600 long GetNextItem( long item, int geometry, int state ) const;
601 void DeleteItem( long index );
602 void DeleteAllItems();
603 void DeleteColumn( int col );
604 void DeleteEverything();
605 void EnsureVisible( long index );
606 long FindItem( long start, const wxString& str, bool partial = false );
607 long FindItem( long start, wxUIntPtr data);
608 long FindItem( const wxPoint& pt );
609 long HitTest( int x, int y, int &flags ) const;
610 void InsertItem( wxListItem &item );
611 void InsertColumn( long col, wxListItem &item );
612 int GetItemWidthWithImage(wxListItem * item);
b18e2046 613 void SortItems( wxListCtrlCompare fn, wxIntPtr data );
ad486020
FM
614
615 size_t GetItemCount() const;
616 bool IsEmpty() const { return GetItemCount() == 0; }
617 void SetItemCount(long count);
618
619 // change the current (== focused) item, send a notification event
620 void ChangeCurrent(size_t current);
621 void ResetCurrent() { ChangeCurrent((size_t)-1); }
622 bool HasCurrent() const { return m_current != (size_t)-1; }
623
624 // send out a wxListEvent
625 void SendNotify( size_t line,
626 wxEventType command,
627 const wxPoint& point = wxDefaultPosition );
628
629 // override base class virtual to reset m_lineHeight when the font changes
630 virtual bool SetFont(const wxFont& font)
631 {
632 if ( !wxWindow::SetFont(font) )
633 return false;
634
635 m_lineHeight = 0;
636
637 return true;
638 }
639
640 // these are for wxListLineData usage only
641
642 // get the backpointer to the list ctrl
643 wxGenericListCtrl *GetListCtrl() const
644 {
645 return wxStaticCast(GetParent(), wxGenericListCtrl);
646 }
647
648 // get the height of all lines (assuming they all do have the same height)
649 wxCoord GetLineHeight() const;
650
651 // get the y position of the given line (only for report view)
652 wxCoord GetLineY(size_t line) const;
653
654 // get the brush to use for the item highlighting
655 wxBrush *GetHighlightBrush() const
656 {
657 return m_hasFocus ? m_highlightBrush : m_highlightUnfocusedBrush;
658 }
659
660 bool HasFocus() const
661 {
662 return m_hasFocus;
663 }
664
665protected:
666 // the array of all line objects for a non virtual list control (for the
667 // virtual list control we only ever use m_lines[0])
668 wxListLineDataArray m_lines;
669
670 // the list of column objects
671 wxListHeaderDataList m_columns;
672
673 // currently focused item or -1
674 size_t m_current;
675
676 // the number of lines per page
677 int m_linesPerPage;
678
679 // this flag is set when something which should result in the window
680 // redrawing happens (i.e. an item was added or deleted, or its appearance
681 // changed) and OnPaint() doesn't redraw the window while it is set which
682 // allows to minimize the number of repaintings when a lot of items are
683 // being added. The real repainting occurs only after the next OnIdle()
684 // call
685 bool m_dirty;
686
687 wxColour *m_highlightColour;
688 wxImageList *m_small_image_list;
689 wxImageList *m_normal_image_list;
690 int m_small_spacing;
691 int m_normal_spacing;
692 bool m_hasFocus;
693
694 bool m_lastOnSame;
695 wxTimer *m_renameTimer;
696 bool m_isCreated;
697 int m_dragCount;
698 wxPoint m_dragStart;
699 ColWidthArray m_aColWidths;
700
701 // for double click logic
702 size_t m_lineLastClicked,
703 m_lineBeforeLastClicked,
704 m_lineSelectSingleOnUp;
705
706protected:
707 wxWindow *GetMainWindowOfCompositeControl() { return GetParent(); }
708
709 // the total count of items in a virtual list control
710 size_t m_countVirt;
711
712 // the object maintaining the items selection state, only used in virtual
713 // controls
714 wxSelectionStore m_selStore;
715
716 // common part of all ctors
717 void Init();
718
719 // get the line data for the given index
720 wxListLineData *GetLine(size_t n) const
721 {
722 wxASSERT_MSG( n != (size_t)-1, _T("invalid line index") );
723
724 if ( IsVirtual() )
725 {
726 wxConstCast(this, wxListMainWindow)->CacheLineData(n);
727 n = 0;
728 }
729
730 return &m_lines[n];
731 }
732
733 // get a dummy line which can be used for geometry calculations and such:
734 // you must use GetLine() if you want to really draw the line
735 wxListLineData *GetDummyLine() const;
736
737 // cache the line data of the n-th line in m_lines[0]
738 void CacheLineData(size_t line);
739
740 // get the range of visible lines
741 void GetVisibleLinesRange(size_t *from, size_t *to);
742
743 // force us to recalculate the range of visible lines
744 void ResetVisibleLinesRange() { m_lineFrom = (size_t)-1; }
745
746 // get the colour to be used for drawing the rules
747 wxColour GetRuleColour() const
748 {
749 return wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT);
750 }
751
752private:
753 // initialize the current item if needed
754 void UpdateCurrent();
755
756 // delete all items but don't refresh: called from dtor
757 void DoDeleteAllItems();
758
759 // the height of one line using the current font
760 wxCoord m_lineHeight;
761
762 // the total header width or 0 if not calculated yet
763 wxCoord m_headerWidth;
764
765 // the first and last lines being shown on screen right now (inclusive),
766 // both may be -1 if they must be calculated so never access them directly:
767 // use GetVisibleLinesRange() above instead
768 size_t m_lineFrom,
769 m_lineTo;
770
771 // the brushes to use for item highlighting when we do/don't have focus
772 wxBrush *m_highlightBrush,
773 *m_highlightUnfocusedBrush;
774
775 // wrapper around the text control currently used for in place editing or
776 // NULL if no item is being edited
777 wxListTextCtrlWrapper *m_textctrlWrapper;
778
779
780 DECLARE_EVENT_TABLE()
781
782 friend class wxGenericListCtrl;
783};
784
785#endif // wxUSE_LISTCTRL
786#endif // _WX_GENERIC_LISTCTRL_PRIVATE_H_