WindowList.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. * Todd Lair
  22. * Andrew Bazan
  23. */
  24. #ifndef _WINDOWLIST_H_
  25. #define _WINDOWLIST_H_
  26. #include <ListItem.h>
  27. #include <OutlineListView.h>
  28. #include <String.h>
  29. class BMessageRunner;
  30. class BPopUpMenu;
  31. class BMenu;
  32. class BList;
  33. class ServerAgent;
  34. class ClientAgent;
  35. class ClientWindow;
  36. class BScrollView;
  37. class Theme;
  38. class WindowListItem : public BListItem
  39. {
  40. public:
  41. WindowListItem (const char *,
  42. int32,
  43. int32,
  44. BView *);
  45. virtual ~WindowListItem (void);
  46. BString Name (void) const;
  47. int32 Type (void) const;
  48. int32 Status (void) const;
  49. int32 SubStatus (void) const;
  50. int32 BlinkState (void) const;
  51. BView *pAgent (void) const;
  52. void SetName (const char *);
  53. void SetStatus (int32);
  54. void SetSubStatus (int32);
  55. void ActivateItem (void);
  56. virtual void DrawItem (BView *,
  57. BRect,
  58. bool complete = false);
  59. void SetNotifyBlinker(int32);
  60. void SetBlinkState(int32);
  61. private:
  62. BString fMyName;
  63. int32 fMyStatus;
  64. int32 fMyType;
  65. int32 fSubStatus; // servers only -- status of collapsed children
  66. BView *fMyAgent;
  67. int32 fBlinkState;
  68. int32 fBlinkStateCount;
  69. BMessageRunner *fBlinker;
  70. };
  71. class WindowList : public BOutlineListView
  72. {
  73. public:
  74. WindowList (BRect);
  75. virtual ~WindowList (void);
  76. virtual void AttachedToWindow (void);
  77. virtual void DetachedFromWindow (void);
  78. virtual void MouseDown (BPoint);
  79. virtual void MessageReceived (BMessage *);
  80. virtual void SelectionChanged (void);
  81. virtual void KeyDown (const char *, int32);
  82. void ClearList (void);
  83. void Activate (int32);
  84. void CloseActive (void);
  85. void SelectLast (void);
  86. void CollapseCurrentServer (void);
  87. void ExpandCurrentServer (void);
  88. void BlinkNotifyChange (int32, ServerAgent *);
  89. int32 GetServer (int32);
  90. void SelectServer (void);
  91. void ContextSelectUp (void);
  92. void ContextSelectDown (void);
  93. void MoveCurrentUp (void);
  94. void MoveCurrentDown (void);
  95. // ClientAgent *Agent (int32, const char *);
  96. void AddAgent (BView *, const char *, int32, bool);
  97. void RemoveAgent (BView *, WindowListItem *);
  98. void Expand (BListItem *);
  99. void Collapse (BListItem *);
  100. private:
  101. BPopUpMenu *fMyPopUp;
  102. WindowListItem *fLastSelected;
  103. Theme *fActiveTheme;
  104. void BuildPopUp (void);
  105. int16 fLastButton,
  106. fClickCount;
  107. BPoint fLastClick;
  108. bigtime_t fLastClickTime;
  109. static int SortListItems (const BListItem *, const BListItem *);
  110. };
  111. #endif