PurpleDialog.h 983 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
  3. * All rights reserved. Distributed under the terms of the MIT license.
  4. */
  5. #ifndef _PURPLE_DIALOG_H
  6. #define _PURPLE_DIALOG_H
  7. #include <libpurple/purple.h>
  8. #include <ObjectList.h>
  9. #include <Window.h>
  10. const uint32 ACTION_BUTTON = 'PDab';
  11. struct RequestAction
  12. {
  13. BString name;
  14. PurpleRequestType type;
  15. int32 index;
  16. union {
  17. PurpleRequestActionCb action;
  18. } callback;
  19. };
  20. class PurpleDialog : public BWindow {
  21. public:
  22. // PURPLE_REQUEST_ACTION
  23. PurpleDialog(const char* title, const char* primary,
  24. const char* secondary, PurpleAccount* account,
  25. va_list actions, size_t action_count, void* user_data);
  26. virtual void MessageReceived(BMessage* msg);
  27. private:
  28. void _InitActionInterface(const char* label, const char* desc);
  29. void _ParseActions(va_list actions, int32 count,
  30. PurpleRequestType type);
  31. BObjectList<RequestAction> fActions;
  32. void* fUserData;
  33. };
  34. #endif // _PURPLE_DIALOG_H