ChannelOptions.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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): Wade Majors <wade@ezri.org>
  20. * Rene Gollent
  21. */
  22. #include "ChannelAgent.h"
  23. #include "ChannelOptions.h"
  24. #include "VisionBase.h"
  25. #include <StringView.h>
  26. #include <stdio.h>
  27. ChannelOptions::ChannelOptions (const char *chan_name_, ChannelAgent *parent_)
  28. : BWindow (
  29. BRect (188.0, 88.0, 600.0, 390.0),
  30. "",
  31. B_TITLED_WINDOW,
  32. B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
  33. parent (parent_),
  34. chan_name (chan_name_)
  35. {
  36. Init();
  37. }
  38. ChannelOptions::~ChannelOptions (void)
  39. {
  40. //
  41. }
  42. bool
  43. ChannelOptions::QuitRequested (void)
  44. {
  45. parent->fMsgr.SendMessage (M_CHANNEL_OPTIONS_CLOSE);
  46. return true;
  47. }
  48. void
  49. ChannelOptions::Init (void)
  50. {
  51. BString temp (S_CHANOPTS_TITLE);
  52. temp.Prepend (chan_name);
  53. SetTitle (temp.String());
  54. bgView = new BView (Bounds(),
  55. "Background",
  56. B_FOLLOW_ALL_SIDES,
  57. B_WILL_DRAW);
  58. bgView->SetViewColor (ui_color (B_PANEL_BACKGROUND_COLOR));
  59. AddChild (bgView);
  60. BStringView *tempStringView = new BStringView (Bounds(),
  61. "temp",
  62. "AEIOUglqj",
  63. 0,
  64. 0);
  65. tempStringView->ResizeToPreferred();
  66. float stringHeight = tempStringView->Frame().bottom;
  67. delete tempStringView;
  68. privilegesView = new BView (BRect (bgView->Frame().left + 2,
  69. bgView->Frame().top + 2,
  70. bgView->Frame().right - 2,
  71. stringHeight+2),
  72. "privilege message",
  73. 0,
  74. B_WILL_DRAW);
  75. privilegesView->SetViewColor (0, 100, 0);
  76. bgView->AddChild (privilegesView);
  77. BString privString; // this will become dynamic based on the current mode
  78. privString += S_CHANOPTS_OPID1;
  79. privString += S_CHANOPTS_OPID2;
  80. BStringView *privMsgView = new BStringView (BRect (privilegesView->Bounds().left,
  81. privilegesView->Bounds().top,
  82. privilegesView->Bounds().right,
  83. stringHeight),
  84. "privMsgView",
  85. privString.String(),
  86. 0,
  87. B_WILL_DRAW);
  88. privMsgView->SetHighColor (255,255,255);
  89. privMsgView->SetAlignment (B_ALIGN_CENTER);
  90. privilegesView->ResizeToPreferred();
  91. privilegesView->AddChild (privMsgView);
  92. }