ProcessChooser.h 913 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibCore/Timer.h>
  8. #include <LibGUI/Dialog.h>
  9. namespace GUI {
  10. class ProcessChooser final : public GUI::Dialog {
  11. C_OBJECT(ProcessChooser);
  12. public:
  13. virtual ~ProcessChooser() override;
  14. pid_t pid() const { return m_pid; }
  15. private:
  16. ProcessChooser(const StringView& window_title = "Process Chooser", const StringView& button_label = "Select", const Gfx::Bitmap* window_icon = nullptr, GUI::Window* parent_window = nullptr);
  17. void set_pid_from_index_and_close(const ModelIndex&);
  18. pid_t m_pid { 0 };
  19. String m_window_title;
  20. String m_button_label;
  21. RefPtr<Gfx::Bitmap> m_window_icon;
  22. RefPtr<TableView> m_table_view;
  23. bool m_refresh_enabled { true };
  24. unsigned m_refresh_interval { 1000 };
  25. RefPtr<Core::Timer> m_refresh_timer;
  26. };
  27. }