Home | History | Annotate | Download | only in Control
      1 // Windows/Control/Window2.h
      2 
      3 #ifndef __WINDOWS_CONTROL_WINDOW2_H
      4 #define __WINDOWS_CONTROL_WINDOW2_H
      5 
      6 #include "../Window.h"
      7 
      8 namespace NWindows {
      9 namespace NControl {
     10 
     11 class CWindow2: public CWindow
     12 {
     13   LRESULT DefProc(UINT message, WPARAM wParam, LPARAM lParam);
     14 public:
     15   CWindow2(HWND newWindow = NULL): CWindow(newWindow){};
     16   virtual ~CWindow2() {};
     17 
     18   bool CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName,
     19       DWORD style, int x, int y, int width, int height,
     20       HWND parentWindow, HMENU idOrHMenu, HINSTANCE instance);
     21 
     22   #ifndef _UNICODE
     23   bool CreateEx(DWORD exStyle, LPCWSTR className, LPCWSTR windowName,
     24       DWORD style, int x, int y, int width, int height,
     25       HWND parentWindow, HMENU idOrHMenu, HINSTANCE instance);
     26   #endif
     27 
     28   virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
     29   virtual bool OnCreate(CREATESTRUCT * /* createStruct */) { return true; }
     30   // virtual LRESULT OnCommand(WPARAM wParam, LPARAM lParam);
     31   virtual bool OnCommand(WPARAM wParam, LPARAM lParam, LRESULT &result);
     32   virtual bool OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result);
     33   virtual bool OnSize(WPARAM /* wParam */, int /* xSize */, int /* ySize */) { return false; }
     34   virtual bool OnNotify(UINT /* controlID */, LPNMHDR /* lParam */, LRESULT & /* result */) { return false; }
     35   virtual void OnDestroy() { PostQuitMessage(0); }
     36   virtual void OnClose() { Destroy(); }
     37   /*
     38   virtual LRESULT  OnHelp(LPHELPINFO helpInfo) { OnHelp(); }
     39   virtual LRESULT  OnHelp() {};
     40   virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
     41   virtual void OnOK() {};
     42   virtual void OnCancel() {};
     43   */
     44 
     45   LONG_PTR SetMsgResult(LONG_PTR newLongPtr) { return SetLongPtr(DWLP_MSGRESULT, newLongPtr); }
     46   LONG_PTR GetMsgResult() const { return GetLongPtr(DWLP_MSGRESULT); }
     47 };
     48 
     49 }}
     50 
     51 #endif
     52