From d98ceebb35211f124312984567d07db5a59bec7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 21 Sep 2005 10:13:46 +0000 Subject: [PATCH] fix my name encoding added a few comonents git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14217 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/installer/DrawButton.cpp | 38 ++++++++++++++++++++++++++ src/apps/installer/DrawButton.h | 26 ++++++++++++++++++ src/apps/installer/InstallerApp.cpp | 2 +- src/apps/installer/InstallerApp.h | 2 +- src/apps/installer/InstallerWindow.cpp | 36 +++++++++++++++++++++++- src/apps/installer/InstallerWindow.h | 7 ++++- src/apps/installer/Jamfile | 6 +++- 7 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 src/apps/installer/DrawButton.cpp create mode 100644 src/apps/installer/DrawButton.h diff --git a/src/apps/installer/DrawButton.cpp b/src/apps/installer/DrawButton.cpp new file mode 100644 index 0000000000..36aab4b858 --- /dev/null +++ b/src/apps/installer/DrawButton.cpp @@ -0,0 +1,38 @@ +/* + * Copyright 2005, J茅r么me Duval. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Reworked from DarkWyrm version in CDPlayer + */ +#include +#include +#include "DrawButton.h" + +DrawButton::DrawButton(BRect frame, const char *name, const char *labelOn, const char* labelOff, + BMessage *msg, int32 resize, int32 flags) + : PaneSwitch(frame, name, "", resize, flags) +{ + fLabelOn = strdup(labelOn); + fLabelOff = strdup(labelOff); + SetMessage(msg); +} + + +DrawButton::~DrawButton(void) +{ + free(fLabelOn); + free(fLabelOff); +} + + +void +DrawButton::Draw(BRect update) +{ + BPoint point(18,9); + if (Value()) { + DrawString(fLabelOn, point); + } else { + DrawString(fLabelOff, point); + } + PaneSwitch::Draw(update); +} diff --git a/src/apps/installer/DrawButton.h b/src/apps/installer/DrawButton.h new file mode 100644 index 0000000000..ad45ba52c5 --- /dev/null +++ b/src/apps/installer/DrawButton.h @@ -0,0 +1,26 @@ +/* + * Copyright 2005, J茅r么me Duval. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Reworked from DarkWyrm version in CDPlayer + */ + +#ifndef _DRAW_BUTTON_H +#define _DRAW_BUTTON_H + +#include "DialogPane.h" + +class DrawButton : public PaneSwitch +{ +public: + DrawButton(BRect frame, const char *name, const char *labelOn, const char* labelOff, + BMessage *msg, int32 resize = B_FOLLOW_LEFT|B_FOLLOW_TOP, + int32 flags = B_WILL_DRAW | B_NAVIGABLE); + ~DrawButton(void); + + void Draw(BRect update); +private: + char* fLabelOn, *fLabelOff; +}; + +#endif diff --git a/src/apps/installer/InstallerApp.cpp b/src/apps/installer/InstallerApp.cpp index 50aed23003..5e95cc9512 100644 --- a/src/apps/installer/InstallerApp.cpp +++ b/src/apps/installer/InstallerApp.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, J閞鬽e DUVAL. All rights reserved. + * Copyright 2005, J茅r么me DUVAL. All rights reserved. * Distributed under the terms of the MIT License. */ diff --git a/src/apps/installer/InstallerApp.h b/src/apps/installer/InstallerApp.h index 1ec644c99a..dd7fa8564c 100644 --- a/src/apps/installer/InstallerApp.h +++ b/src/apps/installer/InstallerApp.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, J閞鬽e DUVAL. All rights reserved. + * Copyright 2005, J茅r么me DUVAL. All rights reserved. * Distributed under the terms of the MIT License. */ diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 00b46add17..c6907c29c6 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -1,15 +1,34 @@ /* - * Copyright 2005, J閞鬽e DUVAL. All rights reserved. + * Copyright 2005, J茅r么me DUVAL. All rights reserved. * Distributed under the terms of the MIT License. */ #include #include +#include "DrawButton.h" #include "InstallerWindow.h" +const uint32 BEGIN_MESSAGE = 'iBMG'; +const uint32 SHOW_BOTTOM_MESSAGE = 'iSMG'; + InstallerWindow::InstallerWindow(BRect frame_rect) : BWindow(frame_rect, "Installer", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) { + + BRect bounds = Bounds(); + bounds.bottom += 1; + bounds.right += 1; + fBackBox = new BBox(bounds, NULL, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); + AddChild(fBackBox); + + fBeginButton = new BButton(BRect(bounds.right-90, bounds.bottom-34, bounds.right-10, bounds.bottom-10), + "begin_button", "Begin", new BMessage(BEGIN_MESSAGE)); + fBeginButton->MakeDefault(true); + fBackBox->AddChild(fBeginButton); + + DrawButton *drawButton = new DrawButton(BRect(bounds.left+12, bounds.bottom-33, bounds.left+100, bounds.bottom-20), + "options_button", "Fewer options", "More options", new BMessage(SHOW_BOTTOM_MESSAGE)); + fBackBox->AddChild(drawButton); // finish creating window Show(); @@ -24,6 +43,10 @@ void InstallerWindow::MessageReceived(BMessage *msg) { switch (msg->what) { + case BEGIN_MESSAGE: + break; + case SHOW_BOTTOM_MESSAGE: + break; default: BWindow::MessageReceived(msg); break; @@ -37,3 +60,14 @@ InstallerWindow::QuitRequested() return true; } + +void +InstallerWindow::ShowBottom(bool show) +{ + if (show) { + + } else { + + } +} + diff --git a/src/apps/installer/InstallerWindow.h b/src/apps/installer/InstallerWindow.h index 1ab782872d..a9a71328b5 100644 --- a/src/apps/installer/InstallerWindow.h +++ b/src/apps/installer/InstallerWindow.h @@ -1,11 +1,13 @@ /* - * Copyright 2005, J閞鬽e DUVAL. All rights reserved. + * Copyright 2005, J茅r么me DUVAL. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _InstallerWindow_h #define _InstallerWindow_h +#include +#include #include class InstallerWindow : public BWindow { @@ -17,6 +19,9 @@ public: virtual bool QuitRequested(); private: + void ShowBottom(bool show); + BBox *fBackBox; + BButton *fBeginButton; }; #endif /* _InstallerWindow_h */ diff --git a/src/apps/installer/Jamfile b/src/apps/installer/Jamfile index fb74d5859d..05e2a5bacb 100644 --- a/src/apps/installer/Jamfile +++ b/src/apps/installer/Jamfile @@ -1,8 +1,12 @@ SubDir OBOS_TOP src apps installer ; +UsePrivateHeaders shared ; +SubDirHdrs [ FDirName $(OBOS_TOP) src kits tracker ] ; + App Installer : + DrawButton.cpp InstallerApp.cpp InstallerWindow.cpp - : libbe.so + : libbe.so libtracker.so : Installer.rdef ;