2 * Copyright (c) 2000, Red Hat, Inc.
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 <rbtcollins@hotmail.com>
24 #define CATEGORY_EXPANDED 0
25 #define CATEGORY_COLLAPSED 1
37 #include "package_meta.h"
44 virtual void paint (HDC hdc
, int x
, int y
, int row
, int show_cat
) = 0;
45 virtual int click (int const myrow
, int const ClickedRow
, int const x
) = 0;
46 virtual int itemcount () const = 0;
47 // this may indicate bad inheritance model.
48 virtual bool IsContainer (void) const = 0;
49 virtual void insert (pick_line
&) = 0;
50 // Never allocate to key, always allocated elsewhere
52 virtual ~ pick_line ()
57 pick_line (char const *aKey
):key(aKey
) {};
58 pick_line (pick_line
const &);
59 pick_line
& operator= (pick_line
const &);
62 class pick_pkg_line
:public pick_line
65 pick_pkg_line (packagemeta
& apkg
):pkg (apkg
)
69 virtual void paint (HDC hdc
, int x
, int y
, int row
, int show_cat
);
70 virtual int click (int const myrow
, int const ClickedRow
, int const x
);
71 virtual int itemcount () const
75 virtual bool IsContainer (void) const
79 virtual void insert (pick_line
&)
86 class pick_category_line
:public pick_line
89 pick_category_line (Category
& _cat
, size_t thedepth
= 0, bool aBool
=
90 true, bool aBool2
= true):pick_line (_cat
.key
), current_default (Default_action
),
91 cat (_cat
), labellength (0), depth(thedepth
)
104 ~pick_category_line (){ empty (); }
105 void ShowLabel(bool aBool
= true) {show_label
= aBool
; if (!show_label
) collapsed
= false;}
106 virtual void paint (HDC hdc
, int x
, int y
, int row
, int show_cat
);
107 virtual int click (int const myrow
, int const ClickedRow
, int const x
);
108 virtual int itemcount () const
112 int t
= show_label
? 1 : 0;
113 for (size_t n
= 1; n
<= bucket
.number (); n
++)
114 t
+= bucket
[n
]->itemcount ();
117 virtual bool IsContainer (void) const
121 virtual void insert (pick_line
& aLine
)
123 bucket
.registerbyobject (aLine
);
133 char const * actiontext();
139 pick_category_line (pick_category_line
const &);
140 pick_category_line
& operator= (pick_category_line
const &);
141 list
< pick_line
, char const *, strcasecmp
> bucket
;
149 views
get_view_mode ()
153 void set_view_mode (views _mode
);
154 struct _header
*headers
;
155 view (views mode
, HWND listview
, Category
&cat
);
156 const char *mode_caption ();
157 void insert_pkg (packagemeta
&);
158 void insert_category (Category
*, bool);
159 void clear_view (void);
160 int click (int row
, int x
);
167 pick_category_line contents
;
168 void scroll (HWND hwnd
, int which
, int *var
, int code
);
169 HWND
ListHeader (void) const
177 static const views Unknown
;
178 static const views PackageFull
;
179 static const views Package
;
180 static const views Category
;
181 static const views NView
;
182 views () : _value (0) {};
183 views (int aInt
) { _value
= aInt
; if (_value
< 0 || _value
> 3)
185 views
& operator++ ();
186 bool operator == (views
const &rhs
) {return _value
== rhs
._value
;}
187 bool operator != (views
const &rhs
) {return _value
!= rhs
._value
;}
188 const char * caption ();
199 void init_headers (HDC dc
);
203 class ChooserPage
:public PropertyPage
209 virtual ~ ChooserPage ()
213 virtual bool OnMessageApp (UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
216 virtual void OnActivate ();
219 #endif /* __cplusplus */
220 #endif /* _CHOOSE_H_ */