AccountsMenu.h 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
  3. * All rights reserved. Distributed under the terms of the MIT license.
  4. */
  5. #ifndef _ACCOUNTS_MENU_H
  6. #define _ACCOUNTS_MENU_H
  7. #include <PopUpMenu.h>
  8. #include "Observer.h"
  9. class ProtocolLooper;
  10. class Server;
  11. class AccountsMenu : public BPopUpMenu, public Observer {
  12. public:
  13. AccountsMenu(const char* name, BMessage msg,
  14. BMessage* allMsg, Server* server);
  15. AccountsMenu(const char* name, BMessage msg,
  16. BMessage* allMsg = NULL);
  17. ~AccountsMenu();
  18. virtual void ObserveInteger(int32 what, int32 value);
  19. void SetDefaultSelection(BMenuItem* item);
  20. int64 GetDefaultSelection() { return fDefaultSelection; }
  21. private:
  22. void _PopulateMenu();
  23. BBitmap* _EnsureProtocolIcon(const char* label,
  24. ProtocolLooper* looper);
  25. BBitmap* _EnsureAsteriskIcon();
  26. BMessage fAccountMessage;
  27. BMessage* fAllMessage;
  28. static int64 fDefaultSelection;
  29. Server* fServer;
  30. };
  31. #endif // _ACCOUNTS_MENU_H