]> cygwin.com Git - cygwin-apps/setup.git/blame - PickView.h
* prereq.cc (PrereqChecker::getUnmetString): Improve dependency list
[cygwin-apps/setup.git] / PickView.h
CommitLineData
97647369
RC
1/*
2 * Copyright (c) 2002 Robert Collins.
3 *
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.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <robertc@hotmail.com>
13 *
14 */
15
c93bc6d0
MB
16#ifndef SETUP_PICKVIEW_H
17#define SETUP_PICKVIEW_H
97647369 18
059906b3 19#include <string>
97647369 20#include "win32.h"
693916f8 21#include "window.h"
ee91d9be 22#include "RECTWrapper.h"
97647369 23
82306ac2 24#define HMARGIN 10
97647369
RC
25#define ROW_MARGIN 5
26#define ICON_MARGIN 4
82306ac2 27#define SPIN_WIDTH 11
97647369 28#define CHECK_SIZE 11
82306ac2 29#define TREE_INDENT 12
97647369 30
525531ca
RC
31#define CATEGORY_EXPANDED 0
32#define CATEGORY_COLLAPSED 1
33
97647369
RC
34class PickView;
35#include "PickCategoryLine.h"
36#include "package_meta.h"
37
693916f8 38class PickView : public Window
97647369
RC
39{
40public:
693916f8
RC
41 virtual bool Create (Window * Parent = NULL, DWORD Style = WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN, RECT * r = NULL);
42 virtual bool registerWindowClass ();
97647369
RC
43 class views;
44 class Header;
45 int num_columns;
22120c90 46 void defaultTrust (trusts trust);
82306ac2
BD
47 void cycleViewMode ();
48 void setViewMode (views mode);
3d4c5ebb 49 void DrawIcon (HDC hdc, int x, int y, HANDLE hIcon);
d2be933d
RC
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);
325bb73a 54 void set_vscroll_info (const RECT &r);
693916f8 55 virtual LRESULT WindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam);
97647369 56 Header *headers;
693916f8
RC
57 PickView (Category & cat);
58 void init(views _mode);
49cf3899 59 ~PickView();
97647369 60 const char *mode_caption ();
82306ac2 61 void setObsolete (bool doit);
97647369
RC
62 void insert_pkg (packagemeta &);
63 void insert_category (Category *, bool);
97647369 64 int click (int row, int x);
ec2dbbf0 65 void refresh();
97647369
RC
66 int current_col;
67 int new_col;
2fa7c5a4
RC
68 int bintick_col;
69 int srctick_col;
97647369 70 int cat_col;
0ac305ec 71 int size_col;
97647369
RC
72 int pkg_col;
73 int last_col;
74 int row_height;
75 TEXTMETRIC tm;
3d4c5ebb
IP
76 HDC bitmap_dc, icon_dc;
77 HBITMAP bm_icon;
78 HRGN rect_icon;
79 HBRUSH bg_fg_brush;
82306ac2 80 HANDLE bm_spin, bm_checkyes, bm_checkno, bm_checkna, bm_treeplus, bm_treeminus;
97647369
RC
81 trusts deftrust;
82 HANDLE sysfont;
83 int scroll_ulc_x, scroll_ulc_y;
84 int header_height;
85 PickCategoryLine contents;
82306ac2 86 void scroll (HWND hwnd, int which, int *var, int code, int howmany);
059906b3
DK
87
88 void SetPackageFilter (const std::string &filterString)
89 {
90 packageFilterString = filterString;
91 }
92
93
97647369
RC
94 HWND ListHeader (void) const
95 {
96 return listheader;
97 }
98
97647369
RC
99 class views
100 {
101 public:
102 static const views Unknown;
103 static const views PackageFull;
104 static const views Package;
e0aec95e
MB
105 static const views PackageKeeps;
106 static const views PackageSkips;
97647369
RC
107 static const views Category;
108 static const views NView;
109 views ():_value (0)
110 {
111 };
112 views (int aInt)
113 {
114 _value = aInt;
e0aec95e 115 if (_value < 0 || _value > 5)
97647369
RC
116 _value = 0;
117 }
118 views & operator++ ();
119 bool operator == (views const &rhs)
120 {
121 return _value == rhs._value;
122 }
123 bool operator != (views const &rhs)
124 {
125 return _value != rhs._value;
126 }
127 const char *caption ();
128
129 private:
130 int _value;
131 };
132
133 class Header
134 {
135 public:
136 const char *text;
97647369
RC
137 int width;
138 int x;
82306ac2 139 bool needs_clip;
97647369
RC
140 };
141
142private:
693916f8 143 static ATOM WindowClassAtom;
97647369
RC
144 HWND listheader;
145 views view_mode;
82306ac2 146 bool showObsolete;
059906b3 147 std::string packageFilterString;
ee91d9be
RC
148
149 // Stuff needed to handle resizing
325bb73a
DK
150 bool hasWindowRect;
151 RECTWrapper lastWindowRect;
0baffe9a
DK
152 int total_delta_x;
153
154 int set_header_column_order (views vm);
97647369
RC
155 void set_headers ();
156 void init_headers (HDC dc);
d19f12fd
MB
157 void note_width (Header *hdrs, HDC dc, const std::string& string,
158 int addend, int column);
97647369
RC
159};
160
d19f12fd
MB
161bool isObsolete (std::set <std::string, casecompare_lt_op> &categories);
162bool isObsolete (const std::string& catname);
82306ac2 163
c93bc6d0 164#endif /* SETUP_PICKVIEW_H */
This page took 0.058212 seconds and 5 git commands to generate.