mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	GScrollBar: Allow scrolling the scrollbar by mouse-wheeling over it
This commit is contained in:
		
							parent
							
								
									076827a05d
								
							
						
					
					
						commit
						dc3c6be6f2
					
				
					 2 changed files with 11 additions and 0 deletions
				
			
		|  | @ -281,6 +281,14 @@ void GScrollBar::mouseup_event(GMouseEvent& event) | |||
|     update(); | ||||
| } | ||||
| 
 | ||||
| void GScrollBar::mousewheel_event(GMouseEvent& event) | ||||
| { | ||||
|     if (!is_scrollable()) | ||||
|         return; | ||||
|     set_value(value() + event.wheel_delta()); | ||||
|     GWidget::mousewheel_event(event); | ||||
| } | ||||
| 
 | ||||
| void GScrollBar::set_automatic_scrolling_active(bool active) | ||||
| { | ||||
|     if (active) { | ||||
|  |  | |||
|  | @ -12,6 +12,8 @@ public: | |||
| 
 | ||||
|     Orientation orientation() const { return m_orientation; } | ||||
| 
 | ||||
|     bool is_scrollable() const { return max() != min(); } | ||||
| 
 | ||||
|     int value() const { return m_value; } | ||||
|     int min() const { return m_min; } | ||||
|     int max() const { return m_max; } | ||||
|  | @ -41,6 +43,7 @@ private: | |||
|     virtual void mousedown_event(GMouseEvent&) override; | ||||
|     virtual void mouseup_event(GMouseEvent&) override; | ||||
|     virtual void mousemove_event(GMouseEvent&) override; | ||||
|     virtual void mousewheel_event(GMouseEvent&) override; | ||||
|     virtual void leave_event(CEvent&) override; | ||||
|     virtual void change_event(GEvent&) override; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling