mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-01 02:58:12 +08:00 
			
		
		
		
	Support multiple kind of cursor shapes. (#505)
https://github.com/ArthurSonzogni/FTXUI/issues/424
This commit is contained in:
		 Arthur Sonzogni (slow/sick)
					Arthur Sonzogni (slow/sick)
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							9babfea36b
						
					
				
				
					commit
					1689802349
				
			| @@ -126,9 +126,6 @@ enum Direction { WIDTH, HEIGHT }; | ||||
| enum Constraint { LESS_THAN, EQUAL, GREATER_THAN }; | ||||
| Decorator size(Direction, Constraint, int value); | ||||
|  | ||||
| // -- | ||||
| Decorator reflect(Box& box); | ||||
|  | ||||
| // --- Frame --- | ||||
| // A frame is a scrollable area. The internal area is potentially larger than | ||||
| // the external one. The internal area is scrolled in order to make visible the | ||||
| @@ -139,7 +136,21 @@ Element yframe(Element); | ||||
| Element focus(Element); | ||||
| Element select(Element); | ||||
|  | ||||
| // --- Cursor --- | ||||
| // Those are similar to `focus`, but also change the shape of the cursor. | ||||
| Element focusCursorBlock(Element); | ||||
| Element focusCursorBlockBlinking(Element); | ||||
| Element focusCursorBar(Element); | ||||
| Element focusCursorBarBlinking(Element); | ||||
| Element focusCursorUnderline(Element); | ||||
| Element focusCursorUnderlineBlinking(Element); | ||||
|  | ||||
| // --- Misc --- | ||||
| Element vscroll_indicator(Element); | ||||
| Decorator reflect(Box& box); | ||||
| // Before drawing the |element| clear the pixel below. This is useful in | ||||
| // combinaison with dbox. | ||||
| Element clear_under(Element element); | ||||
|  | ||||
| // --- Util -------------------------------------------------------------------- | ||||
| Element hcenter(Element); | ||||
| @@ -148,10 +159,6 @@ Element center(Element); | ||||
| Element align_right(Element); | ||||
| Element nothing(Element element); | ||||
|  | ||||
| // Before drawing the |element| clear the pixel below. This is useful in | ||||
| // combinaison with dbox. | ||||
| Element clear_under(Element element); | ||||
|  | ||||
| namespace Dimension { | ||||
| Dimensions Fit(Element&); | ||||
| }  // namespace Dimension | ||||
|   | ||||
| @@ -80,6 +80,17 @@ class Screen { | ||||
|   struct Cursor { | ||||
|     int x = 0; | ||||
|     int y = 0; | ||||
|  | ||||
|     enum Shape { | ||||
|       Hidden = 0, | ||||
|       BlockBlinking = 1, | ||||
|       Block = 2, | ||||
|       UnderlineBlinking = 3, | ||||
|       Underline = 4, | ||||
|       Bar = 5, | ||||
|       BarBlinking = 6, | ||||
|     }; | ||||
|     Shape shape; | ||||
|   }; | ||||
|   Cursor cursor() const { return cursor_; } | ||||
|   void SetCursor(Cursor cursor) { cursor_ = cursor; } | ||||
| @@ -91,8 +102,6 @@ class Screen { | ||||
|   int dimy_; | ||||
|   std::vector<std::vector<Pixel>> pixels_; | ||||
|   Cursor cursor_; | ||||
|  | ||||
|  private: | ||||
| }; | ||||
|  | ||||
| }  // namespace ftxui | ||||
|   | ||||
		Reference in New Issue
	
	Block a user