svcwndhold.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include <precomp.h>
  2. #include "svcwndhold.h"
  3. #include <bfc/common.h>
  4. #include <api/service/svcs/svc_wndcreate.h>
  5. #include <api/wnd/wndclass/blankwnd.h>
  6. ServiceWndHolder::ServiceWndHolder(ifc_window *_child, svc_windowCreate *_svc) :
  7. child(NULL), svc(NULL)
  8. {
  9. setChild(_child, _svc);
  10. }
  11. ServiceWndHolder::~ServiceWndHolder()
  12. {
  13. if (svc != NULL)
  14. {
  15. svc->destroyWindow(child);
  16. if (!svc->refcount())
  17. WASABI_API_SVC->service_release(svc);
  18. } else {
  19. delete static_cast<BaseWnd*>(child);
  20. }
  21. }
  22. int ServiceWndHolder::setChild(ifc_window *_child, svc_windowCreate *_svc)
  23. {
  24. if (child == _child && svc == _svc) return 0;
  25. if (child != NULL) {
  26. if (svc != NULL) {
  27. svc->destroyWindow(child);
  28. if (!svc->refcount())
  29. WASABI_API_SVC->service_release(svc);
  30. svc = NULL;
  31. } else {
  32. delete static_cast<BaseWnd*>(child);
  33. }
  34. child = NULL;
  35. }
  36. child = _child;
  37. svc = _svc;
  38. return 1;
  39. }
  40. ifc_window *ServiceWndHolder::rootwndholder_getRootWnd() {
  41. return child ? child : SERVICEWNDHOLDER_PARENT::rootwndholder_getRootWnd();
  42. }