|
@@ -24,7 +24,7 @@
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
*/
|
|
|
|
|
|
-#include <LibGfx/Bitmap.h>
|
|
|
|
|
|
+#include <LibGfx/CharacterBitmap.h>
|
|
#include <LibGfx/Palette.h>
|
|
#include <LibGfx/Palette.h>
|
|
#include <LibGUI/Painter.h>
|
|
#include <LibGUI/Painter.h>
|
|
#include <LibGUI/ResizeCorner.h>
|
|
#include <LibGUI/ResizeCorner.h>
|
|
@@ -32,14 +32,55 @@
|
|
|
|
|
|
namespace GUI {
|
|
namespace GUI {
|
|
|
|
|
|
|
|
+static const char* s_resize_corner_shadows_data = {
|
|
|
|
+ " "
|
|
|
|
+ " ## "
|
|
|
|
+ " # "
|
|
|
|
+ " "
|
|
|
|
+ " ## ## "
|
|
|
|
+ " # # "
|
|
|
|
+ " "
|
|
|
|
+ " ## ## ## "
|
|
|
|
+ " # # # "
|
|
|
|
+ " "
|
|
|
|
+ " ## ## ## ## "
|
|
|
|
+ " # # # # "
|
|
|
|
+ " "
|
|
|
|
+ " ## ## ## ## ## "
|
|
|
|
+ " # # # # # "
|
|
|
|
+ " "
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const char* s_resize_corner_highlights_data = {
|
|
|
|
+ " "
|
|
|
|
+ " "
|
|
|
|
+ " # "
|
|
|
|
+ " "
|
|
|
|
+ " "
|
|
|
|
+ " # # "
|
|
|
|
+ " "
|
|
|
|
+ " "
|
|
|
|
+ " # # # "
|
|
|
|
+ " "
|
|
|
|
+ " "
|
|
|
|
+ " # # # # "
|
|
|
|
+ " "
|
|
|
|
+ " "
|
|
|
|
+ " # # # # # "
|
|
|
|
+ " "
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static Gfx::CharacterBitmap* s_resize_corner_shadows_bitmap;
|
|
|
|
+static Gfx::CharacterBitmap* s_resize_corner_highlights_bitmap;
|
|
|
|
+static const int s_resize_corner_bitmap_width = 16;
|
|
|
|
+static const int s_resize_corner_bitmap_height = 16;
|
|
|
|
+
|
|
ResizeCorner::ResizeCorner(Widget* parent)
|
|
ResizeCorner::ResizeCorner(Widget* parent)
|
|
: Widget(parent)
|
|
: Widget(parent)
|
|
{
|
|
{
|
|
set_background_role(ColorRole::Button);
|
|
set_background_role(ColorRole::Button);
|
|
set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
|
set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
|
set_preferred_size(16, 16);
|
|
set_preferred_size(16, 16);
|
|
- m_bitmap = Gfx::Bitmap::load_from_file("/res/icons/resize-corner.png");
|
|
|
|
- ASSERT(m_bitmap);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
ResizeCorner::~ResizeCorner()
|
|
ResizeCorner::~ResizeCorner()
|
|
@@ -51,7 +92,15 @@ void ResizeCorner::paint_event(PaintEvent& event)
|
|
Painter painter(*this);
|
|
Painter painter(*this);
|
|
painter.add_clip_rect(event.rect());
|
|
painter.add_clip_rect(event.rect());
|
|
painter.fill_rect(rect(), palette().color(background_role()));
|
|
painter.fill_rect(rect(), palette().color(background_role()));
|
|
- painter.blit({ 0, 0 }, *m_bitmap, m_bitmap->rect());
|
|
|
|
|
|
+
|
|
|
|
+ if (!s_resize_corner_shadows_bitmap)
|
|
|
|
+ s_resize_corner_shadows_bitmap = &Gfx::CharacterBitmap::create_from_ascii(s_resize_corner_shadows_data, s_resize_corner_bitmap_width, s_resize_corner_bitmap_height).leak_ref();
|
|
|
|
+ painter.draw_bitmap({ 0, 0 }, *s_resize_corner_shadows_bitmap, palette().threed_shadow1());
|
|
|
|
+
|
|
|
|
+ if (!s_resize_corner_highlights_bitmap)
|
|
|
|
+ s_resize_corner_highlights_bitmap = &Gfx::CharacterBitmap::create_from_ascii(s_resize_corner_highlights_data, s_resize_corner_bitmap_width, s_resize_corner_bitmap_height).leak_ref();
|
|
|
|
+ painter.draw_bitmap({ 0, 0 }, *s_resize_corner_highlights_bitmap, palette().threed_highlight());
|
|
|
|
+
|
|
Widget::paint_event(event);
|
|
Widget::paint_event(event);
|
|
}
|
|
}
|
|
|
|
|