Moved the instructions from tool tip to a text view.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37322 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Joachim Seemer
2010-06-30 18:04:25 +00:00
parent dae84707ac
commit 75e7233162
5 changed files with 36 additions and 18 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ class OverlayApp : public BApplication {
public: public:
OverlayApp(); OverlayApp();
private: private:
BCatalog fCatalog; BCatalog fCatalog;
}; };
#endif // OVERLAY_APP_H #endif // OVERLAY_APP_H
+32 -7
View File
@@ -13,9 +13,15 @@
#include "OverlayView.h" #include "OverlayView.h"
#include <Catalog.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <Locale.h>
#include <String.h>
#include <TextView.h> #include <TextView.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Main window"
const float kDraggerSize = 7; const float kDraggerSize = 7;
@@ -25,13 +31,26 @@ OverlayView::OverlayView(BRect frame)
{ {
fBitmap = NULL; fBitmap = NULL;
fReplicated = false; fReplicated = false;
frame.left = frame.right - kDraggerSize; frame.left = frame.right - kDraggerSize;
frame.top = frame.bottom - kDraggerSize; frame.top = frame.bottom - kDraggerSize;
BDragger *dragger = new BDragger(frame, this, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); BDragger *dragger = new BDragger(frame, this, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
AddChild(dragger); AddChild(dragger);
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
fText = new BTextView(Bounds(), "bgView", Bounds(), B_FOLLOW_ALL, B_WILL_DRAW);
fText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(fText);
BString text;
text << B_TRANSLATE(
"Enable \"Show replicants\" in Deskbar.\n"
"Drag & drop an image.\n"
"Drag the replicant to the Desktop.");
fText->SetText(text);
fText->SetAlignment(B_ALIGN_CENTER);
fText->MakeSelectable(false);
fText->MoveBy(0, (Bounds().bottom - fText->TextRect().bottom) / 2);
} }
@@ -69,7 +88,7 @@ OverlayView::MessageReceived(BMessage *msg)
{ {
if (fReplicated) if (fReplicated)
break; break;
entry_ref ref; entry_ref ref;
msg->FindRef("refs", &ref); msg->FindRef("refs", &ref);
BEntry entry(&ref); BEntry entry(&ref);
@@ -79,6 +98,11 @@ OverlayView::MessageReceived(BMessage *msg)
fBitmap = BTranslationUtils::GetBitmap(path.Path()); fBitmap = BTranslationUtils::GetBitmap(path.Path());
if (fBitmap != NULL) { if (fBitmap != NULL) {
if (fText != NULL) {
RemoveChild(fText);
fText = NULL;
}
BRect rect = fBitmap->Bounds(); BRect rect = fBitmap->Bounds();
if (!fReplicated) if (!fReplicated)
Window()->ResizeTo(rect.right, rect.bottom); Window()->ResizeTo(rect.right, rect.bottom);
@@ -129,18 +153,19 @@ OverlayView::OverlayAboutRequested()
{ {
BAlert *alert = new BAlert("about", BAlert *alert = new BAlert("about",
"OverlayImage\n" "OverlayImage\n"
"Copyright 1999-2010" "\n\n\t" "Copyright 1999-2010\n\n\t"
"originally by Seth Flaxman" "\n\t" "originally by Seth Flaxman\n\t"
"modified by Hartmuth Reh" "\n\t" "modified by Hartmuth Reh\n\t"
"further modified by Humdinger" "\n", "further modified by Humdinger\n",
"OK"); "OK");
BTextView *view = alert->TextView(); BTextView *view = alert->TextView();
BFont font; BFont font;
view->SetStylable(true); view->SetStylable(true);
view->GetFont(&font); view->GetFont(&font);
font.SetSize(font.Size() + 4); font.SetSize(font.Size() + 7.0f);
font.SetFace(B_BOLD_FACE); font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, 12, &font); view->SetFontAndColor(0, 12, &font);
alert->Go(); alert->Go();
} }
+1
View File
@@ -42,6 +42,7 @@ public:
private: private:
BBitmap *fBitmap; BBitmap *fBitmap;
bool fReplicated; bool fReplicated;
BTextView *fText;
}; };
#endif // OVERLAY_VIEW_H #endif // OVERLAY_VIEW_H
+1 -10
View File
@@ -18,7 +18,6 @@
#include <Catalog.h> #include <Catalog.h>
#include <Locale.h> #include <Locale.h>
#include <String.h> #include <String.h>
#include <TextView.h>
#undef B_TRANSLATE_CONTEXT #undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Main window" #define B_TRANSLATE_CONTEXT "Main window"
@@ -26,7 +25,7 @@
OverlayWindow::OverlayWindow() OverlayWindow::OverlayWindow()
: :
BWindow(BRect(100, 100, 450, 350), "OverlayImage", BWindow(BRect(50, 50, 500, 200), "OverlayImage",
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{ {
OverlayView *replView = new OverlayView(Bounds()); OverlayView *replView = new OverlayView(Bounds());
@@ -35,14 +34,6 @@ OverlayWindow::OverlayWindow()
BView *bgView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW); BView *bgView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW);
bgView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); bgView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(bgView); AddChild(bgView);
BString text;
text << B_TRANSLATE("Enable \"Show replicants\" in Deskbar.");
text << "\n";
text << B_TRANSLATE("Drag & drop an image.");
text << "\n";
text << B_TRANSLATE("Drag the replicant to the Desktop.");
replView->SetToolTip(text);
} }
+1
View File
@@ -14,6 +14,7 @@
#ifndef OVERLAY_WINDOW_H #ifndef OVERLAY_WINDOW_H
#define OVERLAY_WINDOW_H #define OVERLAY_WINDOW_H
#include <TextView.h>
#include <Window.h> #include <Window.h>