mirror of https://github.com/aseprite/aseprite.git
				
				
				
			Make HomeView widget more responsive depending on its current size
This commit is contained in:
		
							parent
							
								
									9157e3dd89
								
							
						
					
					
						commit
						e4667149f4
					
				|  | @ -2,7 +2,7 @@ | |||
| <!-- Copyright (C) 2001-2015 by David Capello --> | ||||
| <gui> | ||||
|   <vbox noborders="true" id="home_view" border="4" childspacing="2" expansive="true"> | ||||
|     <hbox noborders="true"> | ||||
|     <hbox noborders="true" id="header_placeholder"> | ||||
|       <image file="icons/ase48.png" align="center" /> | ||||
|       <vbox border="4" childspacing="4"> | ||||
|         <link id="new_file" text="New File..." style="workspace_link" /> | ||||
|  | @ -13,17 +13,22 @@ | |||
|         <link id="check_update" text="" style="workspace_link" /> | ||||
|       </vbox> | ||||
|     </hbox> | ||||
|     <hbox noborders="true" expansive="true" homogeneous="true" childspacing="2"> | ||||
|       <vbox noborders="true" childspacing="2"> | ||||
|         <label text="Recent files:" style="workspace_label" /> | ||||
|         <view id="files_view" expansive="true" style="workspace_view" /> | ||||
|         <label text="Recent folders:" style="workspace_label" /> | ||||
|         <view id="folders_view" expansive="true" style="workspace_view" /> | ||||
|       </vbox> | ||||
|       <vbox noborders="true" childspacing="2"> | ||||
|     <splitter horizontal="true" noborders="true" childspacing="2" | ||||
|               expansive="true" by="percetage" position="50" > | ||||
|       <splitter vertical="true" noborders="true" childspacing="2"> | ||||
|         <vbox id="files_placeholder"> | ||||
|           <label text="Recent files:" style="workspace_label" /> | ||||
|           <view id="files_view" expansive="true" style="workspace_view" /> | ||||
|         </vbox> | ||||
|         <vbox id="folders_placeholder"> | ||||
|           <label text="Recent folders:" style="workspace_label" /> | ||||
|           <view id="folders_view" expansive="true" style="workspace_view" /> | ||||
|         </vbox> | ||||
|       </splitter> | ||||
|       <vbox id="news_placeholder" noborders="true" childspacing="2"> | ||||
|         <label text="News:" style="workspace_label" /> | ||||
|         <view id="news_view" expansive="true" style="workspace_view" /> | ||||
|       </vbox> | ||||
|     </hbox> | ||||
|     </splitter> | ||||
|   </vbox> | ||||
| </gui> | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ | |||
| #include "base/bind.h" | ||||
| #include "base/exception.h" | ||||
| #include "ui/label.h" | ||||
| #include "ui/resize_event.h" | ||||
| #include "ui/system.h" | ||||
| #include "ui/textbox.h" | ||||
| #include "ui/view.h" | ||||
|  | @ -107,6 +108,15 @@ void HomeView::onOpenFile() | |||
|   UIContext::instance()->executeCommand(command); | ||||
| } | ||||
| 
 | ||||
| void HomeView::onResize(ui::ResizeEvent& ev) | ||||
| { | ||||
|   headerPlaceholder()->setVisible(ev.getBounds().h > 200*ui::guiscale()); | ||||
|   foldersPlaceholder()->setVisible(ev.getBounds().h > 150*ui::guiscale()); | ||||
|   newsPlaceholder()->setVisible(ev.getBounds().w > 200*ui::guiscale()); | ||||
| 
 | ||||
|   ui::VBox::onResize(ev); | ||||
| } | ||||
| 
 | ||||
| void HomeView::onCheckingUpdates() | ||||
| { | ||||
|   checkUpdate()->setText("Checking Updates..."); | ||||
|  |  | |||
|  | @ -50,6 +50,7 @@ namespace app { | |||
|     void onWorkspaceViewSelected() override; | ||||
| 
 | ||||
|   protected: | ||||
|     void onResize(ui::ResizeEvent& ev) override; | ||||
| #ifdef ENABLE_UPDATER | ||||
|     // CheckUpdateDelegate impl
 | ||||
|     void onCheckingUpdates() override; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue