You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ovdCAbstractSettingView.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #include "../ovd_base.h"
  3. #include <cstdlib> // size_t for unix
  4. namespace OpenViBE {
  5. namespace Designer {
  6. namespace Setting {
  7. class CAbstractSettingView
  8. {
  9. public:
  10. virtual ~CAbstractSettingView();
  11. //Store the value of the setting in value
  12. virtual void getValue(CString& value) const = 0;
  13. //Set the view with the value contains in value
  14. virtual void setValue(const CString& value) = 0;
  15. //Get the label which contains the name of the setting
  16. virtual GtkWidget* getNameWidget() { return m_nameWidget; }
  17. //Get the table of widget which display the value of the setting (the entry and all interaction buttons)
  18. virtual GtkWidget* getEntryWidget() { return m_entryNameWidget; }
  19. //This function is use to update the setting index when a setting is suppressed or inserted
  20. virtual void setSettingIndex(const size_t index) { m_index = index; }
  21. //Get the index of the setting
  22. virtual size_t getSettingIndex() { return m_index; }
  23. protected:
  24. //Initialize the common part of all view. If builderName and widgetName are not nullptr, the entryTable and the label
  25. //will be set according to these informations.
  26. //If there are nullptr, name and entry widget will have to be set after with corresponding setter.
  27. CAbstractSettingView(Kernel::IBox& box, const size_t index, const char* builderName, const char* widgetName);
  28. //Return the box which contains the setting
  29. virtual Kernel::IBox& getBox() { return m_box; }
  30. //Set the widget as the new widget name
  31. virtual void setNameWidget(GtkWidget* widget);
  32. //Set the widget as the new widget name
  33. virtual void setEntryWidget(GtkWidget* widget);
  34. //Set the setting view with the current value of the setting
  35. virtual void initializeValue();
  36. //Return a vector which contains the list of the widget contains int the widget widget
  37. virtual void extractWidget(GtkWidget* widget, std::vector<GtkWidget*>& widgets);
  38. //Return the part of the entry table which is not revert or default button
  39. virtual GtkWidget* getEntryFieldWidget() { return m_entryFieldWidget; }
  40. private:
  41. //Generate the label of the setting
  42. virtual void generateNameWidget();
  43. //Generate the table of widget which display the value of the setting (the entry and all interaction buttons)
  44. virtual GtkWidget* generateEntryWidget();
  45. Kernel::IBox& m_box;
  46. size_t m_index = 0;
  47. CString m_settingWidgetName;
  48. GtkWidget* m_nameWidget = nullptr;
  49. GtkWidget* m_entryNameWidget = nullptr;
  50. GtkWidget* m_entryFieldWidget = nullptr;
  51. //If we don't store the builder, the setting name will be free when we'll unref the builder
  52. GtkBuilder* m_builder = nullptr;
  53. };
  54. } // namespace Setting
  55. } // namespace Designer
  56. } // namespace OpenViBE