Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. main.cpp
  2.  
  3. #include "SF.h"
  4. #include "MainInterface.h"
  5.  
  6. LRESULT CALLBACK MainWndProc(
  7.     HWND hwnd,        // handle to window
  8.     UINT uMsg,        // message identifier
  9.     WPARAM wParam,    // first message parameter
  10.     LPARAM lParam);    // second message parameter
  11.  
  12.  
  13. using namespace SF::GUI;
  14.  
  15. int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  16.     LPSTR lpszCmdLine, int nCmdShow)
  17. {
  18.  
  19.     EventHandler::PWindow mywindow(SF::Core::EnvFactory::createWindow());
  20.     mywindow->Show();
  21.  
  22.     std::shared_ptr<PushButton> button = mywindow->createPushButton(L"Testbutton!");
  23.     button->Show();
  24.  
  25.     MainInterface itf;
  26.  
  27.     MainInterface::pCallback cback(new MainInterface::callback(itf, &MainInterface::test));
  28.     button->OnClickHandler(cback);
  29.  
  30.     return EventHandler::runLoop();
  31.  
  32. }
  33.  
  34.  
  35.  
  36. MainInterface.h:
  37.  
  38. #ifndef MAIN_INTERFACE_H
  39. #define MAIN_INTERFACE_H
  40.  
  41. #include "BaseInclude.h"
  42. #include "Event.h"
  43.  
  44. using namespace SF::GUI;
  45. using namespace SF::Core;
  46.  
  47. class MainInterface: public UserInterface{
  48.  
  49.  
  50. public:
  51.     typedef Delegate<MainInterface, bool, SF::GUI::Event> callback;
  52.     typedef std::shared_ptr<MainInterface::callback> pCallback;
  53.  
  54.     bool test(Event evt){
  55.             std::shared_ptr<MsgBox> meineBox = EnvFactory::createMsgBox(std::wstring(L"Es funktioniert!!!"));
  56.         return true;
  57.     }
  58.  
  59. };
  60.  
  61.  
  62. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement