summaryrefslogtreecommitdiffstats
path: root/src/app/listView.cpp
blob: 63a6abf9350ac61fba7eef68779bdcdc01d5b9f5 (plain)
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
// (c) 2004 Max Howell ([email protected])
// See COPYING file for licensing information

#ifndef CODEINELISTVIEW_CPP
#define CODEINELISTVIEW_CPP

#include <tdelistview.h>

namespace Codeine
{
   class ListView : public TDEListView
   {
   public:
      ListView( TQWidget *parent ) : TDEListView( parent )
      {
         addColumn( TQString::null, 0 );
         addColumn( TQString::null );

         setResizeMode( LastColumn );
         setMargin( 2 );
         setSorting( -1 );
         setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum );
         setAllColumnsShowFocus( true );
         setItemMargin( 3 );
      }

      virtual TQSize sizeHint() const
      {
         const TQSize sh = TDEListView::sizeHint();

         return TQSize( sh.width(),
            childCount() == 0
               ? 50
               : TQMIN( sh.height(), childCount() * (firstChild()->height()) + margin() * 2 + 4 + reinterpret_cast<TQWidget*>(header())->height() ) );
      }
   };
}

#endif