mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	Set clang-format macro indent.
1) Set clang-format macro indent. 2) Run clang-format on every files.
This commit is contained in:
		| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_CHECKBOX_HPP | ||||
| #define FTXUI_COMPONENT_CHECKBOX_HPP | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class CheckBox : public Component { | ||||
| @@ -15,8 +16,8 @@ class CheckBox : public Component { | ||||
|   bool state = false; | ||||
|   std::wstring label = L"label"; | ||||
|  | ||||
|   //std::wstring checked = L"[X] "; | ||||
|   //std::wstring unchecked = L"[ ] "; | ||||
|   // std::wstring checked = L"[X] "; | ||||
|   // std::wstring unchecked = L"[ ] "; | ||||
|   std::wstring checked = L"▣ "; | ||||
|   std::wstring unchecked = L"☐ "; | ||||
|  | ||||
| @@ -24,7 +25,7 @@ class CheckBox : public Component { | ||||
|   Decorator unfocused_style = nothing; | ||||
|  | ||||
|   // State update callback. | ||||
|   std::function<void()> on_change = [](){}; | ||||
|   std::function<void()> on_change = []() {}; | ||||
|  | ||||
|   // Component implementation. | ||||
|   Element Render() override; | ||||
|   | ||||
| @@ -11,7 +11,6 @@ class Focus; | ||||
|  | ||||
| class Component { | ||||
|  public: | ||||
|  | ||||
|   // Constructor/Destructor. | ||||
|   Component() = default; | ||||
|   virtual ~Component(); | ||||
|   | ||||
| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_INPUT_H_ | ||||
| #define FTXUI_COMPONENT_INPUT_H_ | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class Input : public Component { | ||||
| @@ -17,8 +18,8 @@ class Input : public Component { | ||||
|   std::wstring placeholder; | ||||
|  | ||||
|   // State update callback. | ||||
|   std::function<void()> on_change = [](){}; | ||||
|   std::function<void()> on_enter = [](){}; | ||||
|   std::function<void()> on_change = []() {}; | ||||
|   std::function<void()> on_enter = []() {}; | ||||
|  | ||||
|   // Component implementation. | ||||
|   Element Render() override; | ||||
|   | ||||
| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_MENU | ||||
| #define FTXUI_COMPONENT_MENU | ||||
|  | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| @@ -22,14 +23,14 @@ class Menu : public Component { | ||||
|   Decorator normal_style = nothing; | ||||
|  | ||||
|   // State update callback. | ||||
|   std::function<void()> on_change = [](){}; | ||||
|   std::function<void()> on_enter = [](){}; | ||||
|   std::function<void()> on_change = []() {}; | ||||
|   std::function<void()> on_enter = []() {}; | ||||
|  | ||||
|   // Component implementation. | ||||
|   Element Render() override; | ||||
|   bool OnEvent(Event) override; | ||||
| }; | ||||
|  | ||||
| }  // namespace ftxui::Component | ||||
| }  // namespace ftxui | ||||
|  | ||||
| #endif /* end of include guard: FTXUI_COMPONENT_MENU */ | ||||
|   | ||||
| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_RADIOBOX_HPP | ||||
| #define FTXUI_COMPONENT_RADIOBOX_HPP | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class RadioBox : public Component { | ||||
| @@ -23,7 +24,7 @@ class RadioBox : public Component { | ||||
|   Decorator unfocused_style = nothing; | ||||
|  | ||||
|   // State update callback. | ||||
|   std::function<void()> on_change = [](){}; | ||||
|   std::function<void()> on_change = []() {}; | ||||
|  | ||||
|   // Component implementation. | ||||
|   Element Render() override; | ||||
|   | ||||
| @@ -1,12 +1,12 @@ | ||||
| #ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | ||||
| #define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | ||||
|  | ||||
| #include <atomic> | ||||
| #include <condition_variable> | ||||
| #include <functional> | ||||
| #include <memory> | ||||
| #include <mutex> | ||||
| #include <queue> | ||||
| #include <atomic> | ||||
|  | ||||
| #include "ftxui/component/event.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| @@ -15,38 +15,38 @@ namespace ftxui { | ||||
| class Component; | ||||
|  | ||||
| class ScreenInteractive : public Screen { | ||||
|   public: | ||||
|     static ScreenInteractive FixedSize(int dimx, int dimy); | ||||
|     static ScreenInteractive Fullscreen(); | ||||
|     static ScreenInteractive FitComponent(); | ||||
|     static ScreenInteractive TerminalOutput(); | ||||
|  public: | ||||
|   static ScreenInteractive FixedSize(int dimx, int dimy); | ||||
|   static ScreenInteractive Fullscreen(); | ||||
|   static ScreenInteractive FitComponent(); | ||||
|   static ScreenInteractive TerminalOutput(); | ||||
|  | ||||
|     ~ScreenInteractive(); | ||||
|     void Loop(Component*); | ||||
|     std::function<void()> ExitLoopClosure(); | ||||
|   ~ScreenInteractive(); | ||||
|   void Loop(Component*); | ||||
|   std::function<void()> ExitLoopClosure(); | ||||
|  | ||||
|     void PostEvent(Event event); | ||||
|   void PostEvent(Event event); | ||||
|  | ||||
|   private: | ||||
|    void Draw(Component* component); | ||||
|    void EventLoop(Component* component); | ||||
|  private: | ||||
|   void Draw(Component* component); | ||||
|   void EventLoop(Component* component); | ||||
|  | ||||
|    enum class Dimension { | ||||
|      FitComponent, | ||||
|      Fixed, | ||||
|      Fullscreen, | ||||
|      TerminalOutput, | ||||
|    }; | ||||
|    Dimension dimension_ = Dimension::Fixed; | ||||
|    ScreenInteractive(int dimx, int dimy, Dimension dimension); | ||||
|   enum class Dimension { | ||||
|     FitComponent, | ||||
|     Fixed, | ||||
|     Fullscreen, | ||||
|     TerminalOutput, | ||||
|   }; | ||||
|   Dimension dimension_ = Dimension::Fixed; | ||||
|   ScreenInteractive(int dimx, int dimy, Dimension dimension); | ||||
|  | ||||
|    std::condition_variable events_queue_cv; | ||||
|    std::mutex events_queue_mutex; | ||||
|    std::queue<Event> events_queue; | ||||
|    std::atomic<bool> quit_ = false; | ||||
|   std::condition_variable events_queue_cv; | ||||
|   std::mutex events_queue_mutex; | ||||
|   std::queue<Event> events_queue; | ||||
|   std::atomic<bool> quit_ = false; | ||||
|  | ||||
|    std::string set_cursor_position; | ||||
|    std::string reset_cursor_position; | ||||
|   std::string set_cursor_position; | ||||
|   std::string reset_cursor_position; | ||||
| }; | ||||
|  | ||||
| }  // namespace ftxui | ||||
|   | ||||
| @@ -1,10 +1,11 @@ | ||||
| #ifndef FTXUI_COMPONENT_TOGGLE_H_ | ||||
| #define FTXUI_COMPONENT_TOGGLE_H_ | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
| #include <string> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class Toggle : public Component { | ||||
| @@ -21,13 +22,13 @@ class Toggle : public Component { | ||||
|   Decorator normal_style = dim; | ||||
|  | ||||
|   // Callback. | ||||
|   std::function<void()> on_change = [](){}; | ||||
|   std::function<void()> on_change = []() {}; | ||||
|  | ||||
|   // Component implementation. | ||||
|   Element Render() override; | ||||
|   bool OnEvent(Event) override; | ||||
| }; | ||||
|  | ||||
| }  // namespace ftxui::Component | ||||
| }  // namespace ftxui | ||||
|  | ||||
| #endif /* end of include guard: FTXUI_COMPONENT_TOGGLE_H_ */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ArthurSonzogni
					ArthurSonzogni