Fixed toolbar and status bar
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "statusbar_gui.h"
|
||||
#include "toolbar_gui.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "settings_gui.h"
|
||||
|
||||
#include "widgets/statusbar_widget.h"
|
||||
|
||||
@@ -104,7 +105,7 @@ struct StatusBarWindow : Window {
|
||||
|
||||
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
|
||||
{
|
||||
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
|
||||
Window::FindWindowPlacementAndResize(min(_toolbar_width, _screen.width - SETTING_BUTTON_HEIGHT * 2), def_height);
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
|
||||
@@ -1541,6 +1541,16 @@ public:
|
||||
* @return the button configuration.
|
||||
*/
|
||||
virtual const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const = 0;
|
||||
|
||||
/**
|
||||
* Override NWidgetContainer::Add to setup minimal button size,
|
||||
* this will force buttons to resize to the min_button size defined in settings
|
||||
*/
|
||||
void Add(NWidgetResizeBase *child)
|
||||
{
|
||||
child->SetMinimalSize(9,9);
|
||||
NWidgetContainer::Add(child);
|
||||
}
|
||||
};
|
||||
|
||||
/** Container for the 'normal' main toolbar */
|
||||
|
||||
@@ -3598,7 +3598,7 @@ void RelocateAllWindows(int neww, int newh)
|
||||
break;
|
||||
|
||||
case WC_STATUS_BAR:
|
||||
ResizeWindow(w, min(neww, _toolbar_width) - w->width, 0, false);
|
||||
ResizeWindow(w, min(neww, min(_toolbar_width, _screen.width - SETTING_BUTTON_HEIGHT * 2)) - w->width, 0, false);
|
||||
|
||||
top = newh - w->height;
|
||||
left = PositionStatusbar(w);
|
||||
|
||||
Reference in New Issue
Block a user