HaikuDepot: add icons to screenshot window tool bar
* Arrow icons instead of text for previous/next buttons
This commit is contained in:
parent
47e34fcb8a
commit
622e144f6c
@ -90,3 +90,18 @@ resource(504, "installed") #'VICN' array {
|
||||
$"010A0002000100"
|
||||
};
|
||||
|
||||
resource(505, "arrow left") #'VICN' array {
|
||||
$"6E6369660304006603005900020006020000003C6000C000000000004C000048"
|
||||
$"A0000080FF80FF00B300010A0722353622362C482C483E363E3648030A000100"
|
||||
$"1240A32D00000000000040A32444CEA044D04B01178322040A0101001240A32D"
|
||||
$"00000000000040A32442FA1242FD7201178322040A0201000240A32D00000000"
|
||||
$"000040A32442FA1242FD72"
|
||||
};
|
||||
|
||||
resource(506, "arrow right") #'VICN' array {
|
||||
$"6E6369660304006603005900020006020000003C6000C000000000004C000048"
|
||||
$"A0000080FF80FF00B300010A0748353448343E223E222C342C3422030A000100"
|
||||
$"1240A32D00000000000040A32444D19644D04B01178322040A0101001240A32D"
|
||||
$"00000000000040A32442FFFF42FD7201178322040A0201000240A32D00000000"
|
||||
$"000040A32442FFFF42FD72"
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "Logger.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ServerSettings.h"
|
||||
#include "ScreenshotWindow.h"
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
@ -48,6 +49,7 @@ App::~App()
|
||||
// around. That's why we do it here.
|
||||
PackageInfo::CleanupDefaultIcon();
|
||||
FeaturedPackagesView::CleanupIcons();
|
||||
ScreenshotWindow::CleanupIcons();
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,11 @@ static const rgb_color kBackgroundColor = { 51, 102, 152, 255 };
|
||||
// Drawn as a border around the screenshots and also what's behind their
|
||||
// transparent regions
|
||||
|
||||
static BitmapRef sNextButtonIcon(
|
||||
new(std::nothrow) SharedBitmap(505), true);
|
||||
static BitmapRef sPreviousButtonIcon(
|
||||
new(std::nothrow) SharedBitmap(506), true);
|
||||
|
||||
|
||||
ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame)
|
||||
:
|
||||
@ -47,13 +52,12 @@ ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame)
|
||||
fIndexView = new BStringView("screenshot index", NULL);
|
||||
|
||||
fToolBar = new BToolBar();
|
||||
fToolBar->AddAction(MSG_PREVIOUS_SCREENSHOT, this, NULL /* todo: icon */,
|
||||
B_TRANSLATE("Show previous screenshot"),
|
||||
B_TRANSLATE("Previous"));
|
||||
fToolBar->AddAction(MSG_NEXT_SCREENSHOT, this, NULL /* todo: icon */,
|
||||
B_TRANSLATE("Show next screenshot"),
|
||||
B_TRANSLATE("Next"));
|
||||
fToolBar->AddGlue();
|
||||
fToolBar->AddAction(MSG_PREVIOUS_SCREENSHOT, this,
|
||||
sNextButtonIcon->Bitmap(SharedBitmap::SIZE_22),
|
||||
NULL, NULL);
|
||||
fToolBar->AddAction(MSG_NEXT_SCREENSHOT, this,
|
||||
sPreviousButtonIcon->Bitmap(SharedBitmap::SIZE_22),
|
||||
NULL, NULL);
|
||||
fToolBar->AddView(fIndexView);
|
||||
fToolBar->AddGlue();
|
||||
fToolBar->AddView(fBarberPole);
|
||||
@ -67,9 +71,9 @@ ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame)
|
||||
|
||||
// Build layout
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(0, 5, 0, 0)
|
||||
.SetInsets(0, 3, 0, 0)
|
||||
.Add(fToolBar)
|
||||
.AddStrut(5)
|
||||
.AddStrut(3)
|
||||
.AddGroup(groupView)
|
||||
.Add(fScreenshotView)
|
||||
.SetInsets(B_USE_WINDOW_INSETS)
|
||||
@ -168,6 +172,14 @@ ScreenshotWindow::SetPackage(const PackageInfoRef& package)
|
||||
}
|
||||
|
||||
|
||||
/* static */ void
|
||||
ScreenshotWindow::CleanupIcons()
|
||||
{
|
||||
sNextButtonIcon.Unset();
|
||||
sPreviousButtonIcon.Unset();
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - private
|
||||
|
||||
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
|
||||
void SetPackage(const PackageInfoRef& package);
|
||||
|
||||
static void CleanupIcons();
|
||||
|
||||
private:
|
||||
void _DownloadScreenshot();
|
||||
|
||||
|
@ -31,6 +31,7 @@ SharedBitmap::SharedBitmap(BBitmap* bitmap)
|
||||
fBitmap[0] = bitmap;
|
||||
fBitmap[1] = NULL;
|
||||
fBitmap[2] = NULL;
|
||||
fBitmap[3] = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +46,7 @@ SharedBitmap::SharedBitmap(int32 resourceID)
|
||||
fBitmap[0] = NULL;
|
||||
fBitmap[1] = NULL;
|
||||
fBitmap[2] = NULL;
|
||||
fBitmap[3] = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +61,7 @@ SharedBitmap::SharedBitmap(const char* mimeType)
|
||||
fBitmap[0] = NULL;
|
||||
fBitmap[1] = NULL;
|
||||
fBitmap[2] = NULL;
|
||||
fBitmap[3] = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -102,6 +105,7 @@ SharedBitmap::SharedBitmap(BPositionIO& data)
|
||||
fBitmap[0] = NULL;
|
||||
fBitmap[1] = NULL;
|
||||
fBitmap[2] = NULL;
|
||||
fBitmap[3] = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -110,6 +114,7 @@ SharedBitmap::~SharedBitmap()
|
||||
delete fBitmap[0];
|
||||
delete fBitmap[1];
|
||||
delete fBitmap[2];
|
||||
delete fBitmap[3];
|
||||
delete[] fBuffer;
|
||||
}
|
||||
|
||||
@ -128,12 +133,18 @@ SharedBitmap::Bitmap(Size which)
|
||||
case SIZE_16:
|
||||
break;
|
||||
|
||||
case SIZE_32:
|
||||
case SIZE_22:
|
||||
index = 1;
|
||||
size = 22;
|
||||
break;
|
||||
|
||||
case SIZE_32:
|
||||
index = 2;
|
||||
size = 32;
|
||||
break;
|
||||
|
||||
case SIZE_64:
|
||||
index = 2;
|
||||
index = 3;
|
||||
size = 64;
|
||||
break;
|
||||
}
|
||||
|
@ -21,8 +21,9 @@ public:
|
||||
enum Size {
|
||||
SIZE_ANY = -1,
|
||||
SIZE_16 = 0,
|
||||
SIZE_32 = 1,
|
||||
SIZE_64 = 2
|
||||
SIZE_22 = 1,
|
||||
SIZE_32 = 2,
|
||||
SIZE_64 = 3
|
||||
};
|
||||
|
||||
SharedBitmap(BBitmap* bitmap);
|
||||
@ -52,7 +53,7 @@ private:
|
||||
uint8* fBuffer;
|
||||
off_t fSize;
|
||||
BString fMimeType;
|
||||
BBitmap* fBitmap[3];
|
||||
BBitmap* fBitmap[4];
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user