1 // EditDialog.cpp
2 
3 #include "StdAfx.h"
4 
5 #include "EditDialog.h"
6 
7 #ifdef LANG
8 #include "LangUtils.h"
9 #endif
10 
OnInit()11 bool CEditDialog::OnInit()
12 {
13   #ifdef LANG
14   LangSetDlgItems(*this, NULL, 0);
15   #endif
16   _edit.Attach(GetItem(IDE_EDIT));
17 
18   SetText(Title);
19   _edit.SetText(Text);
20 
21   NormalizeSize();
22   return CModalDialog::OnInit();
23 }
24 
25 // #define MY_CLOSE_BUTTON__ID IDCANCEL
26 #define MY_CLOSE_BUTTON__ID IDCLOSE
27 
OnSize(WPARAM,int xSize,int ySize)28 bool CEditDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
29 {
30   int mx, my;
31   GetMargins(8, mx, my);
32   int bx1, by;
33   GetItemSizes(MY_CLOSE_BUTTON__ID, bx1, by);
34 
35   // int bx2;
36   // GetItemSizes(IDOK, bx2, by);
37 
38   int y = ySize - my - by;
39   int x = xSize - mx - bx1;
40 
41   /*
42   RECT rect;
43   GetClientRect(&rect);
44   rect.top = y - my;
45   InvalidateRect(&rect);
46   */
47   InvalidateRect(NULL);
48 
49   MoveItem(MY_CLOSE_BUTTON__ID, x, y, bx1, by);
50   // MoveItem(IDOK, x - mx - bx2, y, bx2, by);
51   /*
52   if (wParam == SIZE_MAXSHOW || wParam == SIZE_MAXIMIZED || wParam == SIZE_MAXHIDE)
53     mx = 0;
54   */
55   _edit.Move(mx, my, xSize - mx * 2, y - my * 2);
56   return false;
57 }
58