HaikuDepot: Use a LinkedBitmapView for the screenshot.

This commit is contained in:
Stephan Aßmus 2014-11-29 16:36:08 +01:00
parent 77badf8eca
commit 368ec7fa0e
2 changed files with 16 additions and 2 deletions

View File

@ -43,6 +43,7 @@ Application HaikuDepot :
FilterView.cpp FilterView.cpp
JobStateListener.cpp JobStateListener.cpp
LinkView.cpp LinkView.cpp
LinkedBitmapView.cpp
main.cpp main.cpp
MainWindow.cpp MainWindow.cpp
MarkupTextView.cpp MarkupTextView.cpp

View File

@ -30,6 +30,7 @@
#include "BitmapButton.h" #include "BitmapButton.h"
#include "BitmapView.h" #include "BitmapView.h"
#include "LinkView.h" #include "LinkView.h"
#include "LinkedBitmapView.h"
#include "MarkupTextView.h" #include "MarkupTextView.h"
#include "MessagePackageListener.h" #include "MessagePackageListener.h"
#include "PackageActionHandler.h" #include "PackageActionHandler.h"
@ -662,6 +663,7 @@ private:
enum { enum {
MSG_SHOW_SCREENSHOT = 'shss',
MSG_EMAIL_PUBLISHER = 'emlp', MSG_EMAIL_PUBLISHER = 'emlp',
MSG_VISIT_PUBLISHER_WEBSITE = 'vpws', MSG_VISIT_PUBLISHER_WEBSITE = 'vpws',
}; };
@ -695,7 +697,8 @@ public:
// all other screenshots associated with the package to the same folder // all other screenshots associated with the package to the same folder
// so the user can use the ShowImage navigation to view the other // so the user can use the ShowImage navigation to view the other
// screenshots. // screenshots.
fScreenshotView = new BitmapView("screenshot view"); fScreenshotView = new LinkedBitmapView("screenshot view",
new BMessage(MSG_SHOW_SCREENSHOT));
fScreenshotView->SetExplicitMinSize(BSize(64.0f, 64.0f)); fScreenshotView->SetExplicitMinSize(BSize(64.0f, 64.0f));
fScreenshotView->SetExplicitMaxSize( fScreenshotView->SetExplicitMaxSize(
BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
@ -745,12 +748,20 @@ public:
virtual void AttachedToWindow() virtual void AttachedToWindow()
{ {
fScreenshotView->SetTarget(this);
fEmailLinkView->SetTarget(this);
fWebsiteLinkView->SetTarget(this); fWebsiteLinkView->SetTarget(this);
} }
virtual void MessageReceived(BMessage* message) virtual void MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case MSG_SHOW_SCREENSHOT:
{
printf("MSG_SHOW_SCREENSHOT\n");
break;
}
case MSG_EMAIL_PUBLISHER: case MSG_EMAIL_PUBLISHER:
{ {
// TODO: Implement. If memory serves, there is a // TODO: Implement. If memory serves, there is a
@ -791,6 +802,7 @@ public:
screenshot = bitmapRef->Bitmap(SharedBitmap::SIZE_ANY); screenshot = bitmapRef->Bitmap(SharedBitmap::SIZE_ANY);
} }
fScreenshotView->SetBitmap(screenshot); fScreenshotView->SetBitmap(screenshot);
fScreenshotView->SetEnabled(screenshot != NULL);
} }
void Clear() void Clear()
@ -802,6 +814,7 @@ public:
fWebsiteLinkView->SetText(""); fWebsiteLinkView->SetText("");
fScreenshotView->SetBitmap(NULL); fScreenshotView->SetBitmap(NULL);
fScreenshotView->SetEnabled(false);
} }
private: private:
@ -819,7 +832,7 @@ private:
private: private:
MarkupTextView* fDescriptionView; MarkupTextView* fDescriptionView;
BitmapView* fScreenshotView; LinkedBitmapView* fScreenshotView;
SharedBitmap fEmailIcon; SharedBitmap fEmailIcon;
BitmapView* fEmailIconView; BitmapView* fEmailIconView;