Pogger/src/MainWindow.cpp

84 lines
1.7 KiB
C++
Raw Normal View History

2020-12-30 21:13:12 -06:00
/*
* Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "MainWindow.h"
#include <Button.h>
#include <GroupView.h>
#include <TabView.h>
#include <LayoutBuilder.h>
#include <SeparatorView.h>
#include <String.h>
#include <cstdio>
2020-12-30 21:13:12 -06:00
#include "App.h"
#include "EntriesView.h"
#include "FeedsView.h"
#include "UpdatesView.h"
2020-12-30 21:13:12 -06:00
enum { M_BUTTON_CLICKED = 'btcl' };
MainWindow::MainWindow (void)
:
BWindow(BRect(BPoint(-1000.0, -1000.0), BSize(520, 380)), "Pogger",
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
2020-12-30 21:13:12 -06:00
{
_InitInterface();
MoveOnScreen();
}
void
MainWindow::MessageReceived(BMessage *msg)
{
switch (msg->what)
{
default:
{
BWindow::MessageReceived(msg);
break;
}
}
2020-12-30 21:13:12 -06:00
}
void
MainWindow::_InitInterface()
{
fBaseView = new BGroupView("baseView");
fTabView = new BTabView("tabView", B_WIDTH_FROM_WIDEST);
fFeedsView = new FeedsView("Feeds");
fEntriesView = new EntriesView("Entries");
fUpdatesView = new UpdatesView("Updates");
2020-12-30 21:13:12 -06:00
fTabView->AddTab(fFeedsView);
fTabView->AddTab(fEntriesView);
fTabView->AddTab(fUpdatesView);
2020-12-30 21:13:12 -06:00
fTabView->SetBorder(B_NO_BORDER);
fBaseView->AddChild(fTabView);
fUpdateNowButton = new BButton("updateNow", "Update Now",
new BMessage('iiii'));
fUpdateNowButton->SetTarget(this);
fUpdateNowButton->SetExplicitAlignment(
BAlignment(B_ALIGN_RIGHT, B_ALIGN_MIDDLE));
2020-12-30 21:13:12 -06:00
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(0, B_USE_DEFAULT_SPACING, 0, 0)
.Add(fBaseView)
.Add(new BSeparatorView(B_HORIZONTAL))
.AddGroup(B_HORIZONTAL)
.Add(fUpdateNowButton)
2020-12-30 21:13:12 -06:00
.SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_WINDOW_SPACING)
.End()
.End();
2020-12-30 21:13:12 -06:00
}