mail: switch 'Set to' window to use layout lib
'File -> Close and -> Set to' used a hard-coded window size and control/button layout. Switch this to use the layout library for proper scaling. Change-Id: Ieeed93da82fb6bdcca852e3bb2f5a3315222ec27 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6303 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
863bf67d8d
commit
457e5ee245
@ -1327,11 +1327,6 @@ TMailWindow::MessageReceived(BMessage* msg)
|
||||
PostMessage(&message);
|
||||
} else {
|
||||
BRect r = Frame();
|
||||
r.left += ((r.Width() - STATUS_WIDTH) / 2);
|
||||
r.right = r.left + STATUS_WIDTH;
|
||||
r.top += 40;
|
||||
r.bottom = r.top + STATUS_HEIGHT;
|
||||
|
||||
BString string = "could not read";
|
||||
BNode node(fRef);
|
||||
if (node.InitCheck() == B_OK)
|
||||
|
@ -37,6 +37,7 @@ All rights reserved.
|
||||
#include <Directory.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <fs_index.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Node.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <Path.h>
|
||||
@ -54,27 +55,6 @@ All rights reserved.
|
||||
#include "Messages.h"
|
||||
|
||||
|
||||
#define STATUS_TEXT "Status:"
|
||||
#define STATUS_FIELD_H 10
|
||||
#define STATUS_FIELD_V 8
|
||||
#define STATUS_FIELD_WIDTH (STATUS_WIDTH - STATUS_FIELD_H)
|
||||
#define STATUS_FIELD_HEIGHT 16
|
||||
|
||||
#define BUTTON_WIDTH 70
|
||||
#define BUTTON_HEIGHT 20
|
||||
|
||||
#define S_OK_BUTTON_X1 (STATUS_WIDTH - BUTTON_WIDTH - 6)
|
||||
#define S_OK_BUTTON_Y1 (STATUS_HEIGHT - (BUTTON_HEIGHT + 10))
|
||||
#define S_OK_BUTTON_X2 (S_OK_BUTTON_X1 + BUTTON_WIDTH)
|
||||
#define S_OK_BUTTON_Y2 (S_OK_BUTTON_Y1 + BUTTON_HEIGHT)
|
||||
#define S_OK_BUTTON_TEXT "OK"
|
||||
|
||||
#define S_CANCEL_BUTTON_X1 (S_OK_BUTTON_X1 - (BUTTON_WIDTH + 10))
|
||||
#define S_CANCEL_BUTTON_Y1 S_OK_BUTTON_Y1
|
||||
#define S_CANCEL_BUTTON_X2 (S_CANCEL_BUTTON_X1 + BUTTON_WIDTH)
|
||||
#define S_CANCEL_BUTTON_Y2 S_OK_BUTTON_Y2
|
||||
#define S_CANCEL_BUTTON_TEXT "Cancel"
|
||||
|
||||
enum status_messages {
|
||||
STATUS = 128,
|
||||
OK,
|
||||
@ -86,28 +66,27 @@ TStatusWindow::TStatusWindow(BRect rect, BMessenger target, const char* status)
|
||||
: BWindow(rect, "", B_MODAL_WINDOW, B_NOT_RESIZABLE),
|
||||
fTarget(target)
|
||||
{
|
||||
BView* view = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
AddChild(view);
|
||||
fStatus = new BTextControl("status", "Status:", status,
|
||||
new BMessage(STATUS));
|
||||
|
||||
BRect r(STATUS_FIELD_H, STATUS_FIELD_V,
|
||||
STATUS_FIELD_WIDTH, STATUS_FIELD_V + STATUS_FIELD_HEIGHT);
|
||||
BButton *ok = new BButton("ok", "OK", new BMessage(OK));
|
||||
ok->MakeDefault(true);
|
||||
|
||||
fStatus = new BTextControl(r, "", STATUS_TEXT, status, new BMessage(STATUS));
|
||||
view->AddChild(fStatus);
|
||||
BButton *cancel = new BButton("cancel", "Cancel", new BMessage(CANCEL));
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.Add(fStatus)
|
||||
.End()
|
||||
.AddStrut(B_USE_SMALL_SPACING)
|
||||
.AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING, 0)
|
||||
.AddStrut(B_USE_SMALL_SPACING)
|
||||
.Add(cancel)
|
||||
.Add(ok);
|
||||
|
||||
fStatus->SetDivider(fStatus->StringWidth(STATUS_TEXT) + 6);
|
||||
fStatus->BTextControl::MakeFocus(true);
|
||||
|
||||
r.Set(S_OK_BUTTON_X1, S_OK_BUTTON_Y1, S_OK_BUTTON_X2, S_OK_BUTTON_Y2);
|
||||
BButton *button = new BButton(r, "", S_OK_BUTTON_TEXT, new BMessage(OK));
|
||||
view->AddChild(button);
|
||||
button->MakeDefault(true);
|
||||
|
||||
r.Set(S_CANCEL_BUTTON_X1, S_CANCEL_BUTTON_Y1, S_CANCEL_BUTTON_X2, S_CANCEL_BUTTON_Y2);
|
||||
button = new BButton(r, "", S_CANCEL_BUTTON_TEXT, new BMessage(CANCEL));
|
||||
view->AddChild(button);
|
||||
|
||||
ResizeToPreferred();
|
||||
Show();
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,6 @@ class BTextControl;
|
||||
|
||||
#define INDEX_STATUS "_status"
|
||||
|
||||
#define STATUS_WIDTH 220
|
||||
#define STATUS_HEIGHT 80
|
||||
|
||||
|
||||
class TStatusWindow : public BWindow {
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user