Skip to content

Commit

Permalink
Sudoku: use the layout API.
Browse files Browse the repository at this point in the history
* This removes the CenteredViewContainer class, as it is no longer
  being used.
* However, it also removes its functionality, ie. the Sudoku view now
  fills the complete window (even without any borders), again.
  • Loading branch information
axeld committed Nov 7, 2015
1 parent 2e14f93 commit 5ab027f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 95 deletions.
48 changes: 0 additions & 48 deletions src/apps/sudoku/CenteredViewContainer.cpp

This file was deleted.

27 changes: 0 additions & 27 deletions src/apps/sudoku/CenteredViewContainer.h

This file was deleted.

1 change: 0 additions & 1 deletion src/apps/sudoku/Jamfile
Expand Up @@ -3,7 +3,6 @@ SubDir HAIKU_TOP src apps sudoku ;
UsePrivateHeaders shared ;

Application Sudoku :
CenteredViewContainer.cpp
ProgressWindow.cpp
Sudoku.cpp
SudokuField.cpp
Expand Down
9 changes: 9 additions & 0 deletions src/apps/sudoku/SudokuView.cpp
Expand Up @@ -61,6 +61,15 @@ SudokuView::SudokuView(BRect frame, const char* name,
}


SudokuView::SudokuView(const char* name, const BMessage& settings)
:
BView(name,
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS)
{
_InitObject(&settings);
}


SudokuView::SudokuView(BMessage* archive)
:
BView(archive)
Expand Down
2 changes: 2 additions & 0 deletions src/apps/sudoku/SudokuView.h
Expand Up @@ -35,6 +35,8 @@ class SudokuView : public BView {
SudokuView(BRect frame, const char* name,
const BMessage& settings,
uint32 resizingMode);
SudokuView(const char* name,
const BMessage& settings);
SudokuView(BMessage* archive);
virtual ~SudokuView();

Expand Down
27 changes: 8 additions & 19 deletions src/apps/sudoku/SudokuWindow.cpp
Expand Up @@ -14,6 +14,7 @@
#include <File.h>
#include <FilePanel.h>
#include <FindDirectory.h>
#include <LayoutBuilder.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
Expand All @@ -22,7 +23,6 @@

#include <be_apps/Tracker/RecentItems.h>

#include "CenteredViewContainer.h"
#include "ProgressWindow.h"
#include "Sudoku.h"
#include "SudokuField.h"
Expand Down Expand Up @@ -176,27 +176,16 @@ SudokuWindow::SudokuWindow()
int32 level = 0;
settings.FindInt32("level", &level);

// create GUI
// Create GUI

BMenuBar* menuBar = new BMenuBar(Bounds(), "menu");
AddChild(menuBar);
BMenuBar* menuBar = new BMenuBar("menu");
fSudokuView = new SudokuView("sudoku view", settings);

frame.top = menuBar->Frame().bottom;
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(menuBar)
.Add(fSudokuView);

BView* top = new BView(frame, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(top);

fSudokuView = new SudokuView(
top->Bounds().InsetByCopy(10, 10).OffsetToSelf(0, 0),
"sudoku view", settings, B_FOLLOW_NONE);
CenteredViewContainer* container = new CenteredViewContainer(fSudokuView,
top->Bounds().InsetByCopy(10, 10),
"center", B_FOLLOW_ALL);
container->SetHighColor(top->ViewColor());
top->AddChild(container);

// add menu
// Build menu

// "File" menu
BMenu* menu = new BMenu(B_TRANSLATE("File"));
Expand Down

0 comments on commit 5ab027f

Please sign in to comment.