1
0

OBSBasicInteraction.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /******************************************************************************
  2. Copyright (C) 2023 by Lain Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include "ui_OBSBasicInteraction.h"
  16. #include <obs.hpp>
  17. #include <QDialog>
  18. class OBSBasic;
  19. class OBSEventFilter;
  20. class OBSBasicInteraction : public QDialog {
  21. Q_OBJECT
  22. private:
  23. OBSBasic *main;
  24. std::unique_ptr<Ui::OBSBasicInteraction> ui;
  25. OBSSource source;
  26. OBSSignal removedSignal;
  27. OBSSignal renamedSignal;
  28. std::unique_ptr<OBSEventFilter> eventFilter;
  29. static void SourceRemoved(void *data, calldata_t *params);
  30. static void SourceRenamed(void *data, calldata_t *params);
  31. static void DrawPreview(void *data, uint32_t cx, uint32_t cy);
  32. bool GetSourceRelativeXY(int mouseX, int mouseY, int &x, int &y);
  33. bool HandleMouseClickEvent(QMouseEvent *event);
  34. bool HandleMouseMoveEvent(QMouseEvent *event);
  35. bool HandleMouseWheelEvent(QWheelEvent *event);
  36. bool HandleFocusEvent(QFocusEvent *event);
  37. bool HandleKeyEvent(QKeyEvent *event);
  38. OBSEventFilter *BuildEventFilter();
  39. public:
  40. OBSBasicInteraction(QWidget *parent, OBSSource source_);
  41. ~OBSBasicInteraction();
  42. void Init();
  43. protected:
  44. virtual void closeEvent(QCloseEvent *event) override;
  45. virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
  46. };