1*f6dc9357SAndroid Build Coastguard Worker // ComboDialog.cpp
2*f6dc9357SAndroid Build Coastguard Worker
3*f6dc9357SAndroid Build Coastguard Worker #include "StdAfx.h"
4*f6dc9357SAndroid Build Coastguard Worker #include "ComboDialog.h"
5*f6dc9357SAndroid Build Coastguard Worker
6*f6dc9357SAndroid Build Coastguard Worker #include "../../../Windows/Control/Static.h"
7*f6dc9357SAndroid Build Coastguard Worker
8*f6dc9357SAndroid Build Coastguard Worker #ifdef Z7_LANG
9*f6dc9357SAndroid Build Coastguard Worker #include "LangUtils.h"
10*f6dc9357SAndroid Build Coastguard Worker #endif
11*f6dc9357SAndroid Build Coastguard Worker
12*f6dc9357SAndroid Build Coastguard Worker using namespace NWindows;
13*f6dc9357SAndroid Build Coastguard Worker
OnInit()14*f6dc9357SAndroid Build Coastguard Worker bool CComboDialog::OnInit()
15*f6dc9357SAndroid Build Coastguard Worker {
16*f6dc9357SAndroid Build Coastguard Worker #ifdef Z7_LANG
17*f6dc9357SAndroid Build Coastguard Worker LangSetDlgItems(*this, NULL, 0);
18*f6dc9357SAndroid Build Coastguard Worker #endif
19*f6dc9357SAndroid Build Coastguard Worker _comboBox.Attach(GetItem(IDC_COMBO));
20*f6dc9357SAndroid Build Coastguard Worker
21*f6dc9357SAndroid Build Coastguard Worker /*
22*f6dc9357SAndroid Build Coastguard Worker // why it doesn't work ?
23*f6dc9357SAndroid Build Coastguard Worker DWORD style = _comboBox.GetStyle();
24*f6dc9357SAndroid Build Coastguard Worker if (Sorted)
25*f6dc9357SAndroid Build Coastguard Worker style |= CBS_SORT;
26*f6dc9357SAndroid Build Coastguard Worker else
27*f6dc9357SAndroid Build Coastguard Worker style &= ~CBS_SORT;
28*f6dc9357SAndroid Build Coastguard Worker _comboBox.SetStyle(style);
29*f6dc9357SAndroid Build Coastguard Worker */
30*f6dc9357SAndroid Build Coastguard Worker SetText(Title);
31*f6dc9357SAndroid Build Coastguard Worker
32*f6dc9357SAndroid Build Coastguard Worker NControl::CStatic staticContol;
33*f6dc9357SAndroid Build Coastguard Worker staticContol.Attach(GetItem(IDT_COMBO));
34*f6dc9357SAndroid Build Coastguard Worker staticContol.SetText(Static);
35*f6dc9357SAndroid Build Coastguard Worker _comboBox.SetText(Value);
36*f6dc9357SAndroid Build Coastguard Worker FOR_VECTOR (i, Strings)
37*f6dc9357SAndroid Build Coastguard Worker _comboBox.AddString(Strings[i]);
38*f6dc9357SAndroid Build Coastguard Worker NormalizeSize();
39*f6dc9357SAndroid Build Coastguard Worker return CModalDialog::OnInit();
40*f6dc9357SAndroid Build Coastguard Worker }
41*f6dc9357SAndroid Build Coastguard Worker
OnSize(WPARAM,int xSize,int ySize)42*f6dc9357SAndroid Build Coastguard Worker bool CComboDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
43*f6dc9357SAndroid Build Coastguard Worker {
44*f6dc9357SAndroid Build Coastguard Worker int mx, my;
45*f6dc9357SAndroid Build Coastguard Worker GetMargins(8, mx, my);
46*f6dc9357SAndroid Build Coastguard Worker int bx1, bx2, by;
47*f6dc9357SAndroid Build Coastguard Worker GetItemSizes(IDCANCEL, bx1, by);
48*f6dc9357SAndroid Build Coastguard Worker GetItemSizes(IDOK, bx2, by);
49*f6dc9357SAndroid Build Coastguard Worker int y = ySize - my - by;
50*f6dc9357SAndroid Build Coastguard Worker int x = xSize - mx - bx1;
51*f6dc9357SAndroid Build Coastguard Worker
52*f6dc9357SAndroid Build Coastguard Worker InvalidateRect(NULL);
53*f6dc9357SAndroid Build Coastguard Worker
54*f6dc9357SAndroid Build Coastguard Worker MoveItem(IDCANCEL, x, y, bx1, by);
55*f6dc9357SAndroid Build Coastguard Worker MoveItem(IDOK, x - mx - bx2, y, bx2, by);
56*f6dc9357SAndroid Build Coastguard Worker ChangeSubWindowSizeX(_comboBox, xSize - mx * 2);
57*f6dc9357SAndroid Build Coastguard Worker return false;
58*f6dc9357SAndroid Build Coastguard Worker }
59*f6dc9357SAndroid Build Coastguard Worker
OnOK()60*f6dc9357SAndroid Build Coastguard Worker void CComboDialog::OnOK()
61*f6dc9357SAndroid Build Coastguard Worker {
62*f6dc9357SAndroid Build Coastguard Worker _comboBox.GetText(Value);
63*f6dc9357SAndroid Build Coastguard Worker CModalDialog::OnOK();
64*f6dc9357SAndroid Build Coastguard Worker }
65