Regenerate Japanese resources
[cygwin-setup.git] / ControlAdjuster.h
blob50690b4c8539c64da6dcc314866d7eee10db47b9
1 /*
2 * Copyright (c) 2003, Frank Richter <frichter@gmx.li>
3 * Copyrught (c) 2003, Robert Collins <rbtcollins@hotmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * A copy of the GNU General Public License can be found at
11 * http://www.gnu.org/
13 * Written by Frank Richter.
17 #ifndef SETUP_CONTROLADJUSTER_H
18 #define SETUP_CONTROLADJUSTER_H
20 #include <vector>
22 #include "win32.h"
23 #include "RECTWrapper.h"
26 This is a helper class to move/resize controls of a dialog when it's size
27 is changed. It's no fancy layouting stuff, but rather just moving them
28 around - to, for example, keep controls at the bottom really at the bottom
29 when the size changes.
32 enum ControlPosition {
33 CP_LEFT = 0,
34 CP_TOP = CP_LEFT,
35 CP_CENTERED,
36 CP_RIGHT,
37 CP_BOTTOM = CP_RIGHT,
38 CP_STRETCH,
39 CP_STRETCH_LEFTHALF,
40 CP_STRETCH_TOPHALF = CP_STRETCH_LEFTHALF,
41 CP_STRETCH_RIGHTHALF,
42 CP_STRETCH_BOTTOMHALF = CP_STRETCH_RIGHTHALF
45 /* left and right double as top and bottom. better labels sought. */
46 class ControlDimension
48 public:
49 ControlDimension(long &anInt1, long &anInt2) :
50 left(anInt1), right (anInt2){}
51 long &left;
52 long &right;
55 class ControlAdjuster
57 public:
58 struct ControlInfo
60 void adjust(HWND dlg, int widthChange, int heightChange) const;
61 // Control ID
62 int control;
64 * Position specifiers.
66 ControlPosition horizontalPos;
67 ControlPosition verticalPos;
68 private:
69 void adjust (ControlPosition const &how, ControlDimension &where, int by) const;
73 Adjust all the controls.
74 'controlInfo' an array with the moving information.
75 The terminating item of the array should have an ID <= 0.
77 static void AdjustControls (HWND dlg, const ControlInfo controlInfo[],
78 int widthChange, int heightChange);
81 class SizeProcessor
83 typedef std::vector<const ControlAdjuster::ControlInfo*> ControlInfos;
84 ControlInfos controlInfos;
85 bool rectValid;
86 RECTWrapper lastRect;
87 public:
88 SizeProcessor ();
90 void AddControlInfo (const ControlAdjuster::ControlInfo* controlInfo);
91 void UpdateSize (HWND dlg);
94 #endif // SETUP_CONTROLADJUSTER_H