|
sprint 1-alpha
|
Template Window Implementation. More...
#include <windows.h>#include <string>#include "Window.h"#include "DC.h"#include "Bitmap.h"#include "Font.h"#include "Brush.h"Go to the source code of this file.
Classes | |
| class | sprint::gtl::CDefaultWindowTraits |
| A Default collection of Window Traits (should be overwritten entirelly) More... | |
| class | sprint::gtl::CChildWindowTraits |
| struct | sprint::gtl::TWindowManager< T > |
Namespaces | |
| namespace | sprint |
Sprint is a lightweight c++ library to handle different task with crossplatform attention (trying to compile both on MSVC and Mingw on WIn32 and GCC on Linux. | |
| namespace | sprint::gtl |
GTL, GUI Template Library is an ATL compatible framework, oriented to cross-compile Win32 application on more operative systems. | |
Defines | |
| #define | BEGIN_COMMAND_MAP |
| Crea un wrapper per gestire i WM_COMMAND. | |
| #define | END_COMMAND_MAP |
| #define | HANDLE_COMMAND(id, fn) case id: wnd->fn(); break; |
| #define | HANDLE_COMMAND_(id, fn, param) case id: wnd->fn(param); break; |
| #define | HANDLE_CHECKBOX(id, fn) case id: wnd->fn( SendMessage((HWND) lParam, BM_GETCHECK, 0,0)==BST_CHECKED); break; |
| #define | HANDLE_EDITBOX(id, fn) case id: wnd->fn( HIWORD(wParam) ); break; |
| #define | HANDLE_EDITBOX_EX(id, fn) case id: wnd->fn( (HWND) lParam, HIWORD(wParam) ); break; |
| #define | DECLARE_WINDOW_OBJECT(T) |
| #define | BEGIN_MSG_MAP |
| Crea la WindowProcedure, funzione che Windows chiama per ogni messaggio. | |
| #define | END_MSG_MAP |
| Chiude la WindowProcedure, tutti i messaggi non processati vengono passati al Default. | |
| #define | HANDLE_ON_PAINT(fn) case WM_PAINT: Mgr::This(hwnd)->fn(); return 0; |
| #define | HANDLE_ON_COMMAND(fn) case WM_COMMAND: Mgr::This(hwnd)->fn((int) LOWORD(wParam), (HWND) lParam, (UINT) HIWORD(wParam)); return 0; |
| #define | HANDLE_ON_DESTROY(fn) case WM_DESTROY: Mgr::This(hwnd)->fn(); return 0; |
| #define | HANDLE_ON_LBUTTONDOWN(fn) case WM_LBUTTONDOWN: Mgr::This(hwnd)->fn(false, (int)LOWORD(lParam), (int)HIWORD(lParam), wParam); return 0; |
| #define | HANDLE_ON_MOUSEMOVE(fn) case WM_MOUSEMOVE: Mgr::This(hwnd)->fn((int)LOWORD(lParam), (int)HIWORD(lParam), wParam); return 0; |
| #define | HANDLE_ON_LBUTTONDBLCLK(fn) case WM_LBUTTONDBLCLK: Mgr::This(hwnd)->fn(true, (int)LOWORD(lParam), (int)HIWORD(lParam), wParam); return 0; |
| #define | HANDLE_ON_LBUTTONUP(fn) case WM_LBUTTONUP: Mgr::This(hwnd)->fn((int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)wParam); return 0; |
| #define | HANDLE_ON_TIMER(fn) case WM_TIMER: Mgr::This(hwnd)->fn(wParam); return 0; |
| #define | HANDLE_ON_SETFONT(fn) case WM_SETFONT: Mgr::This(hwnd)->fn((HFONT)wParam); return 0; |
| #define | HAVE_ON_PAINT HANDLE_ON_PAINT(OnPaint) |
| void OnPaint(); | |
| #define | HAVE_ON_COMMAND HANDLE_ON_COMMAND(OnCommand) |
| usa BEGIN_COMMAND_MAP meglio | |
| #define | HAVE_ON_DESTROY HANDLE_ON_DESTROY(OnDestroy) |
| void OnDestroy() | |
| #define | HAVE_ON_LBUTTONDOWN HANDLE_ON_LBUTTONDOWN(OnLButtonDown) |
| void OnLButtonDown(bool bDoubleClick, int x, int y, UINT keyFlags); | |
| #define | HAVE_ON_LBUTTONDBLCLK HANDLE_ON_LBUTTONDBLCLK(OnLButtonDown) |
| void OnLButtonDown(bool bDoubleClick, int x, int y, UINT keyFlags); | |
| #define | HAVE_ON_MOUSEMOVE HANDLE_ON_MOUSEMOVE(OnMouseMove) |
| void OnLButtonDown(bool bDoubleClick, int x, int y, UINT keyFlags); | |
| #define | HAVE_ON_LBUTTONUP HANDLE_ON_LBUTTONUP(OnLButtonUp) |
| void OnLButtonUp(int x, int y, UINT keyFlags); | |
| #define | HAVE_ON_TIMER HANDLE_ON_TIMER(OnTimer) |
| void OnTimer(int id) | |
| #define | HAVE_ON_SETFONT HANDLE_ON_SETFONT(OnSetFont) |
Template Window Implementation.
| #define BEGIN_COMMAND_MAP |
case WM_COMMAND: \ wnd = Mgr::This(hwnd); \ switch(LOWORD(wParam)) \ { \
Crea un wrapper per gestire i WM_COMMAND.
| #define BEGIN_MSG_MAP |
static LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) \ { \ typedef gtl::TWindowManager<This_t> Mgr; \ This_t *wnd; \ switch (message) \ { \ case WM_CREATE: \ { \ LPCREATESTRUCT lpCreateStruct = reinterpret_cast<LPCREATESTRUCT>(lParam) ; \ wnd = Mgr::OnCreate(hwnd, lpCreateStruct); \ wnd->SetHwnd(hwnd); \ return wnd->OnCreate(lpCreateStruct); \ }
Crea la WindowProcedure, funzione che Windows chiama per ogni messaggio.
| #define DECLARE_WINDOW_OBJECT | ( | T | ) |
static const char *ClassName() { return #T; } \ typedef T This_t;
| #define END_COMMAND_MAP |
} \
return 0;
| #define END_MSG_MAP |
default: \ return DefWindowProc (hwnd, message, wParam, lParam); \ } \ return 0; \ }
Chiude la WindowProcedure, tutti i messaggi non processati vengono passati al Default.
| #define HANDLE_CHECKBOX | ( | id, | |
| fn | |||
| ) | case id: wnd->fn( SendMessage((HWND) lParam, BM_GETCHECK, 0,0)==BST_CHECKED); break; |
All'interno di BEGIN_COMMAND_MAP .. END_COMMAND_MAP gestisce i checkbox OnCheckBox( bool checked );
| #define HANDLE_COMMAND | ( | id, | |
| fn | |||
| ) | case id: wnd->fn(); break; |
All'interno di BEGIN_COMMAND_MAP .. END_COMMAND_MAP gestisce i pulsanti e i menu OnMyAction();
| #define HANDLE_EDITBOX | ( | id, | |
| fn | |||
| ) | case id: wnd->fn( HIWORD(wParam) ); break; |
All'interno di BEGIN_COMMAND_MAP .. END_COMMAND_MAP gestisce editbox OnEditBox( int NotifyCode );
| #define HANDLE_EDITBOX_EX | ( | id, | |
| fn | |||
| ) | case id: wnd->fn( (HWND) lParam, HIWORD(wParam) ); break; |
All'interno di BEGIN_COMMAND_MAP .. END_COMMAND_MAP gestisce editbox OnEditBox( HWND hWnd, int NotifyCode );
1.7.4