Advertisement
Guest User

waid\application.d

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