/[H6]/h6-udlånssystemDlg.cpp
ViewVC logotype

Annotation of /h6-udlånssystemDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9 - (hide annotations) (download)
Wed Aug 30 21:57:57 2006 UTC (17 years, 8 months ago) by torben
File size: 3962 byte(s)
Finished (???) administration part - plus made a dummy offline version of the DatabaseLayer class.
1 torben 1 // h6-udlånssystemDlg.cpp : implementation file
2     //
3    
4     #include "stdafx.h"
5     #include "h6-udlånssystem.h"
6     #include "h6-udlånssystemDlg.h"
7 torben 3 #include ".\h6-udlånssystemdlg.h"
8 torben 1
9 torben 9 #include "commonstorage.h"
10     #include "databaselayer.h"
11    
12 torben 1 #ifdef _DEBUG
13     #define new DEBUG_NEW
14     #endif
15    
16    
17     // CAboutDlg dialog used for App About
18    
19     class CAboutDlg : public CDialog
20     {
21     public:
22     CAboutDlg();
23    
24     // Dialog Data
25     enum { IDD = IDD_ABOUTBOX };
26    
27     protected:
28     virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
29    
30     // Implementation
31     protected:
32     DECLARE_MESSAGE_MAP()
33     };
34    
35     CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
36     {
37     }
38    
39     void CAboutDlg::DoDataExchange(CDataExchange* pDX)
40     {
41     CDialog::DoDataExchange(pDX);
42     }
43    
44     BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
45     END_MESSAGE_MAP()
46    
47    
48     // Ch6udlnssystemDlg dialog
49    
50    
51    
52     Ch6udlnssystemDlg::Ch6udlnssystemDlg(CWnd* pParent /*=NULL*/)
53     : CDialog(Ch6udlnssystemDlg::IDD, pParent)
54     {
55     m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
56     }
57    
58     void Ch6udlnssystemDlg::DoDataExchange(CDataExchange* pDX)
59     {
60     CDialog::DoDataExchange(pDX);
61 torben 4 DDX_Control(pDX, IDC_TAB, m_tabs);
62 torben 1 }
63    
64     BEGIN_MESSAGE_MAP(Ch6udlnssystemDlg, CDialog)
65     ON_WM_SYSCOMMAND()
66     ON_WM_PAINT()
67     ON_WM_QUERYDRAGICON()
68     //}}AFX_MSG_MAP
69 torben 3 ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
70 torben 9 ON_COMMAND(ID_FILE_EXIT, OnFileExit)
71 torben 1 END_MESSAGE_MAP()
72    
73    
74     // Ch6udlnssystemDlg message handlers
75    
76     BOOL Ch6udlnssystemDlg::OnInitDialog()
77     {
78     CDialog::OnInitDialog();
79    
80     // Add "About..." menu item to system menu.
81    
82     // IDM_ABOUTBOX must be in the system command range.
83     ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
84     ASSERT(IDM_ABOUTBOX < 0xF000);
85    
86     CMenu* pSysMenu = GetSystemMenu(FALSE);
87     if (pSysMenu != NULL)
88     {
89     CString strAboutMenu;
90     strAboutMenu.LoadString(IDS_ABOUTBOX);
91     if (!strAboutMenu.IsEmpty())
92     {
93     pSysMenu->AppendMenu(MF_SEPARATOR);
94     pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
95     }
96     }
97    
98     // Set the icon for this dialog. The framework does this automatically
99     // when the application's main window is not a dialog
100     SetIcon(m_hIcon, TRUE); // Set big icon
101     SetIcon(m_hIcon, FALSE); // Set small icon
102    
103 torben 4 m_tabs.InsertItem(0,"Search");
104     m_tabs.InsertItem(1,"Result");
105     m_tabs.InsertItem(2,"Administration");
106     m_tabs.Init();
107     m_tabs.SetCurSel(0);
108    
109 torben 9
110     DatabaseLayer *dbl = new DatabaseLayer;
111     CommonStorage::Instance()->setDBLayer(dbl);
112    
113    
114 torben 1 // TODO: Add extra initialization here
115    
116     return TRUE; // return TRUE unless you set the focus to a control
117     }
118    
119     void Ch6udlnssystemDlg::OnSysCommand(UINT nID, LPARAM lParam)
120     {
121     if ((nID & 0xFFF0) == IDM_ABOUTBOX)
122     {
123     CAboutDlg dlgAbout;
124     dlgAbout.DoModal();
125     }
126     else
127     {
128     CDialog::OnSysCommand(nID, lParam);
129     }
130     }
131    
132     // If you add a minimize button to your dialog, you will need the code below
133     // to draw the icon. For MFC applications using the document/view model,
134     // this is automatically done for you by the framework.
135    
136     void Ch6udlnssystemDlg::OnPaint()
137     {
138     if (IsIconic())
139     {
140     CPaintDC dc(this); // device context for painting
141    
142     SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
143    
144     // Center icon in client rectangle
145     int cxIcon = GetSystemMetrics(SM_CXICON);
146     int cyIcon = GetSystemMetrics(SM_CYICON);
147     CRect rect;
148     GetClientRect(&rect);
149     int x = (rect.Width() - cxIcon + 1) / 2;
150     int y = (rect.Height() - cyIcon + 1) / 2;
151    
152     // Draw the icon
153     dc.DrawIcon(x, y, m_hIcon);
154     }
155     else
156     {
157     CDialog::OnPaint();
158     }
159     }
160    
161     // The system calls this function to obtain the cursor to display while the user drags
162     // the minimized window.
163     HCURSOR Ch6udlnssystemDlg::OnQueryDragIcon()
164     {
165     return static_cast<HCURSOR>(m_hIcon);
166     }
167 torben 3
168     void Ch6udlnssystemDlg::OnHelpAbout()
169     {
170     MessageBox("DA6H :: Udlånssystem\r\nLavet af:\r\nKevin, Hedin & Torben");
171     }
172 torben 9
173     void Ch6udlnssystemDlg::OnFileExit()
174     {
175     // TODO: Add your command handler code here
176     OnOK();
177     }

  ViewVC Help
Powered by ViewVC 1.1.20