PrefsWindow.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * The contents of this file are subject to the Mozilla Public
  3. * License Version 1.1 (the "License"); you may not use this file
  4. * except in compliance with the License. You may obtain a copy of
  5. * the License at http://www.mozilla.org/MPL/
  6. *
  7. * Software distributed under the License is distributed on an "AS
  8. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9. * implied. See the License for the specific language governing
  10. * rights and limitations under the License.
  11. *
  12. * The Original Code is Vision.
  13. *
  14. * The Initial Developer of the Original Code is The Vision Team.
  15. * Portions created by The Vision Team are
  16. * Copyright (C) 1999, 2000, 2001 The Vision Team. All Rights
  17. * Reserved.
  18. *
  19. * Contributor(s): Rene Gollent
  20. */
  21. #include "PrefsWindow.h"
  22. #include "PrefGeneral.h"
  23. #include "Vision.h"
  24. #include <View.h>
  25. #include <OutlineListView.h>
  26. #include <Box.h>
  27. #include <ScrollView.h>
  28. PrefsWindow::PrefsWindow(void)
  29. : BWindow (BRect (88.0, 108.0, 0.0, 0.0),
  30. S_PREFSWIN_TITLE,
  31. B_TITLED_WINDOW,
  32. B_ASYNCHRONOUS_CONTROLS)
  33. {
  34. GeneralPrefsView *generalView = new GeneralPrefsView(BRect(0.0, 0.0, 0.0, 0.0),
  35. "view", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
  36. ResizeTo(generalView->Bounds().Width(), generalView->Bounds().Height());
  37. BBox *box = new BBox (Bounds().InsetByCopy(-1,-1), "box", B_FOLLOW_ALL_SIDES);
  38. AddChild(box);
  39. box->AddChild(generalView);
  40. generalView->MoveTo ((box->Bounds().Width() - generalView->Bounds().Width()) / 2,
  41. (box->Bounds().Height() - generalView->Bounds().Height()) / 2);
  42. BRect prefsRect (vision_app->GetRect ("GenPrefWinRect"));
  43. if (prefsRect.Width() != 0.0 && prefsRect.Height() != 0.0)
  44. {
  45. ResizeTo (prefsRect.Width(), prefsRect.Height());
  46. MoveTo (prefsRect.left, prefsRect.top);
  47. }
  48. }
  49. PrefsWindow::~PrefsWindow(void)
  50. {
  51. }
  52. bool
  53. PrefsWindow::QuitRequested(void)
  54. {
  55. vision_app->SetRect ("GenPrefWinRect", Frame());
  56. be_app_messenger.SendMessage (M_PREFS_CLOSE);
  57. return true;
  58. }