2 * Copyright (c) 2002 Robert Collins.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins <robertc@hotmail.com>
16 #ifndef SETUP_PICKVIEW_H
17 #define SETUP_PICKVIEW_H
22 #include "RECTWrapper.h"
29 #define TREE_INDENT 12
31 #define CATEGORY_EXPANDED 0
32 #define CATEGORY_COLLAPSED 1
35 #include "PickCategoryLine.h"
36 #include "package_meta.h"
38 class PickView
: public Window
41 virtual bool Create (Window
* Parent
= NULL
, DWORD Style
= WS_OVERLAPPEDWINDOW
| WS_VISIBLE
| WS_CLIPCHILDREN
, RECT
* r
= NULL
);
42 virtual bool registerWindowClass ();
46 void defaultTrust (trusts trust
);
47 void cycleViewMode ();
48 void setViewMode (views mode
);
49 void DrawIcon (HDC hdc
, int x
, int y
, HANDLE hIcon
);
50 void paint (HWND hwnd
);
51 LRESULT CALLBACK
list_click (HWND hwnd
, BOOL dblclk
, int x
, int y
, UINT hitCode
);
52 LRESULT CALLBACK
list_hscroll (HWND hwnd
, HWND hctl
, UINT code
, int pos
);
53 LRESULT CALLBACK
list_vscroll (HWND hwnd
, HWND hctl
, UINT code
, int pos
);
54 void set_vscroll_info (const RECT
&r
);
55 virtual LRESULT
WindowProc (UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
57 PickView (Category
& cat
);
58 void init(views _mode
);
60 const char *mode_caption ();
61 void setObsolete (bool doit
);
62 void insert_pkg (packagemeta
&);
63 void insert_category (Category
*, bool);
64 int click (int row
, int x
);
76 HDC bitmap_dc
, icon_dc
;
80 HANDLE bm_spin
, bm_checkyes
, bm_checkno
, bm_checkna
, bm_treeplus
, bm_treeminus
;
83 int scroll_ulc_x
, scroll_ulc_y
;
85 PickCategoryLine contents
;
86 void scroll (HWND hwnd
, int which
, int *var
, int code
, int howmany
);
88 void SetPackageFilter (const std::string
&filterString
)
90 packageFilterString
= filterString
;
94 HWND
ListHeader (void) const
102 static const views Unknown
;
103 static const views PackageFull
;
104 static const views Package
;
105 static const views PackageKeeps
;
106 static const views PackageSkips
;
107 static const views Category
;
108 static const views NView
;
115 if (_value
< 0 || _value
> 5)
118 views
& operator++ ();
119 bool operator == (views
const &rhs
)
121 return _value
== rhs
._value
;
123 bool operator != (views
const &rhs
)
125 return _value
!= rhs
._value
;
127 const char *caption ();
143 static ATOM WindowClassAtom
;
147 std::string packageFilterString
;
149 // Stuff needed to handle resizing
151 RECTWrapper lastWindowRect
;
154 int set_header_column_order (views vm
);
156 void init_headers (HDC dc
);
157 void note_width (Header
*hdrs
, HDC dc
, const std::string
& string
,
158 int addend
, int column
);
161 bool isObsolete (std::set
<std::string
, casecompare_lt_op
> &categories
);
162 bool isObsolete (const std::string
& catname
);
164 #endif /* SETUP_PICKVIEW_H */