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
13 * Written by Frank Richter.
17 #ifndef SETUP_CONTROLADJUSTER_H
18 #define SETUP_CONTROLADJUSTER_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
{
40 CP_STRETCH_TOPHALF
= CP_STRETCH_LEFTHALF
,
42 CP_STRETCH_BOTTOMHALF
= CP_STRETCH_RIGHTHALF
45 /* left and right double as top and bottom. better labels sought. */
46 class ControlDimension
49 ControlDimension(long &anInt1
, long &anInt2
) :
50 left(anInt1
), right (anInt2
){}
60 void adjust(HWND dlg
, int widthChange
, int heightChange
) const;
64 * Position specifiers.
66 ControlPosition horizontalPos
;
67 ControlPosition verticalPos
;
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
);
83 typedef std::vector
<const ControlAdjuster::ControlInfo
*> ControlInfos
;
84 ControlInfos controlInfos
;
90 void AddControlInfo (const ControlAdjuster::ControlInfo
* controlInfo
);
91 void UpdateSize (HWND dlg
);
94 #endif // SETUP_CONTROLADJUSTER_H