* use Ryan's new BAboutWindow class (also removed the hint that this app

originally was a birthday present for Ingo... hope he is Ok with that)
* fixed ticket #1424, now it uses three empty buttons for new pads
* cloned pads are now opened at an offset, otherwise one wouldn't have any
  visual feedback that something happened with a cloned pad on top of the
  original


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22055 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2007-08-25 17:34:43 +00:00
parent 86519fe39d
commit 227fb2b11c
4 changed files with 48 additions and 19 deletions

View File

@ -6,9 +6,12 @@
* Stephan Aßmus <superstippi@gmx.de>
*/
#include "App.h"
#include <stdio.h>
#include <Alert.h>
#include <AboutWindow.h>
#include <Entry.h>
#include <Message.h>
#include <String.h>
@ -17,7 +20,6 @@
#include "MainWindow.h"
#include "App.h"
// constructor
App::App()
@ -73,7 +75,7 @@ App::ReadyToRun()
}
if (!windowAdded) {
MainWindow* window = new MainWindow("Pad 1", frame);
MainWindow* window = new MainWindow("Pad 1", frame, true);
window->Show();
}
}
@ -85,11 +87,13 @@ App::MessageReceived(BMessage* message)
switch (message->what) {
case MSG_ADD_WINDOW: {
BMessage* settings = new BMessage('sett');
message->FindMessage("window", settings);
bool wasCloned = message->FindMessage("window", settings) == B_OK;
BString name("Pad ");
name << CountWindows() + 1;
MainWindow* window = new MainWindow(name.String(),
BRect(50.0, 50.0, 65.0, 100.0), settings);
if (wasCloned)
window->MoveBy(10, 10);
window->Show();
break;
}
@ -103,8 +107,8 @@ App::MessageReceived(BMessage* message)
void
App::AboutRequested()
{
(new BAlert("about", "LaunchBox by stippi\n\n"
"for bonefish\n\n\n"
"v1.1.0",
"Neat", NULL, NULL))->Go(NULL);
const char* authors[2];
authors[0] = "Stephan Aßmus (aka stippi)";
authors[1] = NULL;
(new BAboutWindow("LaunchBox", 2004, authors))->Show();
}

View File

@ -2,6 +2,8 @@ SubDir HAIKU_TOP src apps launchbox ;
AddSubDirSupportedPlatforms libbe_test ;
UsePrivateHeaders shared ;
Application LaunchBox :
App.cpp
IconButton.cpp
@ -12,7 +14,7 @@ Application LaunchBox :
PadView.cpp
Panel.cpp
support.cpp
: be translation
: be translation libshared.a
: LaunchBox.rdef
;

View File

@ -27,7 +27,7 @@
#include "PadView.h"
// constructor
MainWindow::MainWindow(const char* name, BRect frame)
MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons)
: BWindow(frame, name,
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
@ -36,15 +36,19 @@ MainWindow::MainWindow(const char* name, BRect frame)
fSettings(new BMessage('sett')),
fPadView(new PadView("pad view")),
fLastID(0),
fNamePanelFrame(-1000.0, -1000.0, -900.0, -900.0),
fNamePanelFrame(-1000.0, -1000.0, -800.0, -900.0),
fAutoRaise(false),
fShowOnAllWorkspaces(true)
{
bool buttonsAdded = false;
if (load_settings(fSettings, "main_settings", "LaunchBox") >= B_OK)
buttonsAdded = LoadSettings(fSettings);
if (!buttonsAdded)
if (!buttonsAdded) {
if (addDefaultButtons)
_AddDefaultButtons();
else
_AddEmptyButtons();
}
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(fPadView);
@ -65,7 +69,7 @@ MainWindow::MainWindow(const char* name, BRect frame, BMessage* settings)
fShowOnAllWorkspaces(true)
{
if (!LoadSettings(settings))
_AddDefaultButtons();
_AddEmptyButtons();
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(fPadView);
@ -474,6 +478,7 @@ MainWindow::_AdjustLocation(BRect frame)
ResizeTo(frame.Width(), frame.Height());
}
// _AddDefaultButtons
void
MainWindow::_AddDefaultButtons()
{
@ -514,4 +519,21 @@ MainWindow::_AddDefaultButtons()
button->SetTo("application/x-vnd.Haiku-Terminal", true);
}
// _AddEmptyButtons
void
MainWindow::_AddEmptyButtons()
{
LaunchButton* button = new LaunchButton("launch button", fLastID++, NULL,
new BMessage(MSG_LAUNCH));
fPadView->AddButton(button);
button = new LaunchButton("launch button", fLastID++, NULL,
new BMessage(MSG_LAUNCH));
fPadView->AddButton(button);
button = new LaunchButton("launch button", fLastID++, NULL,
new BMessage(MSG_LAUNCH));
fPadView->AddButton(button);
}

View File

@ -27,10 +27,10 @@ enum {
class MainWindow : public BWindow {
public:
MainWindow(const char* name,
BRect frame);
MainWindow(const char* name,
BRect frame, BMessage* settings);
MainWindow(const char* name, BRect frame,
bool addDefaultButtons = false);
MainWindow(const char* name, BRect frame,
BMessage* settings);
virtual ~MainWindow();
// BWindow interface
@ -63,6 +63,7 @@ class MainWindow : public BWindow {
void _GetLocation();
void _AdjustLocation(BRect frame);
void _AddDefaultButtons();
void _AddEmptyButtons();
BMessage* fSettings;
PadView* fPadView;