Advertisement
Guest User

application.d

a guest
Jan 4th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 1.49 KB | None | 0 0
  1. // waid\application.d
  2. // written by beta69
  3. module waid.application;
  4.  
  5. import waid.window;
  6. import waid.winapi;
  7.  
  8. import std.c.windows.windows;
  9.  
  10. private shared Window[int] Windows;
  11.  
  12. private shared HINSTANCE S_Instance;
  13. private shared HINSTANCE S_pInstance;
  14. private shared LPSTR S_lpCmdLine;
  15. private shared int S_iCmdShow;
  16.  
  17. /**
  18.  Sets the standard windows application information.
  19. */
  20. void SetStandardWin(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR cmdL, int cmdS)
  21. {
  22.         S_Instance = cast(shared(HINSTANCE))hInstance;
  23.         S_pInstance = cast(shared(HINSTANCE))prevInstance;
  24.         S_lpCmdLine = cast(shared(LPSTR))cmdL;
  25.         S_iCmdShow = cast(shared(int))cmdS;
  26. }
  27.  
  28. /**
  29.  Gets the standard windows application instance.
  30.  */
  31. HINSTANCE GetStandardInstance()
  32. {
  33.     return cast(HINSTANCE)S_Instance;
  34. }
  35.  
  36. /**
  37.  Gets the standard windows application previous instance.
  38.  */
  39. HINSTANCE GetStandardPrevInstance()
  40. {
  41.     return cast(HINSTANCE)S_pInstance;
  42. }
  43.  
  44. /**
  45.  Gets the standard windows application cmd line.
  46.  */
  47. LPSTR GetStandardCmdLine()
  48. {
  49.     return cast(LPSTR)S_lpCmdLine;
  50. }
  51. /**
  52.  Gets the standard windows application cmd show.
  53.  */
  54. int GetStandardCmdShow()
  55. {
  56.     return cast(int)S_iCmdShow;
  57. }
  58.  
  59. /**
  60.  Adds a window to the application.
  61.  */
  62. void AddWindow(Window W)
  63. {
  64.     synchronized
  65.     {
  66.         Window[int] windows = cast(Window[int])Windows;
  67.         windows[W.IDC] = W;
  68.     }
  69. }
  70.  
  71. /**
  72.  Removes a window from the application.
  73.  */
  74. void RemoveWindow(Window W)
  75. {
  76.     W.Dispose();
  77.    
  78.     Windows.remove(W.IDC);
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement