]> cygwin.com Git - cygwin-apps/setup.git/blob - PickView.h
2003-10-16 Frank Richter <frichter@gmx.li>
[cygwin-apps/setup.git] / PickView.h
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
16 #ifndef SETUP_PICKVIEW_H
17 #define SETUP_PICKVIEW_H
18
19 #include "win32.h"
20 #include "String++.h"
21 #include "window.h"
22 #include "RECTWrapper.h"
23
24 #define HMARGIN 10
25 #define ROW_MARGIN 5
26 #define ICON_MARGIN 4
27 #define RTARROW_WIDTH 11
28 #define SPIN_WIDTH 11
29 #define NEW_COL_SIZE_SLOP (ICON_MARGIN + SPIN_WIDTH + RTARROW_WIDTH)
30 #define CHECK_SIZE 11
31
32 #define CATEGORY_EXPANDED 0
33 #define CATEGORY_COLLAPSED 1
34
35 class PickView;
36 #include "PickCategoryLine.h"
37 #include "package_meta.h"
38
39 class PickView : public Window
40 {
41 public:
42 virtual bool Create (Window * Parent = NULL, DWORD Style = WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN, RECT * r = NULL);
43 virtual bool registerWindowClass ();
44 class views;
45 class Header;
46 int num_columns;
47 views get_view_mode ()
48 {
49 return view_mode;
50 };
51 void defaultTrust (trusts trust);
52 void set_view_mode (views _mode);
53 void setViewMode (PickView::views mode);
54 void paint (HWND hwnd);
55 LRESULT CALLBACK list_click (HWND hwnd, BOOL dblclk, int x, int y, UINT hitCode);
56 LRESULT CALLBACK list_hscroll (HWND hwnd, HWND hctl, UINT code, int pos);
57 LRESULT CALLBACK list_vscroll (HWND hwnd, HWND hctl, UINT code, int pos);
58 virtual LRESULT WindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam);
59 Header *headers;
60 PickView (Category & cat);
61 void init(views _mode);
62 ~PickView();
63 const char *mode_caption ();
64 void insert_pkg (packagemeta &);
65 void insert_category (Category *, bool);
66 void clear_view (void);
67 int click (int row, int x);
68 void refresh();
69 int current_col;
70 int new_col;
71 int bintick_col;
72 int srctick_col;
73 int cat_col;
74 int pkg_col;
75 int last_col;
76 int row_height;
77 TEXTMETRIC tm;
78 HDC bitmap_dc;
79 HANDLE bm_spin,bm_rtarrow, bm_checkyes, bm_checkno, bm_checkna;
80 trusts deftrust;
81 HANDLE sysfont;
82 int scroll_ulc_x, scroll_ulc_y;
83 int header_height;
84 PickCategoryLine contents;
85 void scroll (HWND hwnd, int which, int *var, int code);
86 HWND ListHeader (void) const
87 {
88 return listheader;
89 }
90
91 class views
92 {
93 public:
94 static const views Unknown;
95 static const views PackageFull;
96 static const views Package;
97 static const views PackageKeeps;
98 static const views PackageSkips;
99 static const views Category;
100 static const views NView;
101 views ():_value (0)
102 {
103 };
104 views (int aInt)
105 {
106 _value = aInt;
107 if (_value < 0 || _value > 5)
108 _value = 0;
109 }
110 views & operator++ ();
111 bool operator == (views const &rhs)
112 {
113 return _value == rhs._value;
114 }
115 bool operator != (views const &rhs)
116 {
117 return _value != rhs._value;
118 }
119 const char *caption ();
120
121 private:
122 int _value;
123 };
124
125 class Header
126 {
127 public:
128 const char *text;
129 int slen;
130 int width;
131 int x;
132 };
133
134 private:
135 static ATOM WindowClassAtom;
136 HWND listheader;
137 views view_mode;
138
139 // Stuff needed to handle resizing
140 bool hasClientRect;
141 RECTWrapper lastClientRect;
142
143 void set_headers ();
144 void init_headers (HDC dc);
145 void note_width (Header *hdrs, HDC dc, String const &string, int addend,
146 int column);
147 };
148
149 #endif /* SETUP_PICKVIEW_H */
This page took 0.043881 seconds and 6 git commands to generate.