2013-08-09 00:01:20 +00:00
|
|
|
// Aseprite UI Library
|
2020-07-07 22:06:48 +00:00
|
|
|
// Copyright (C) 2018-2020 Igara Studio S.A.
|
2016-03-09 14:00:17 +00:00
|
|
|
// Copyright (C) 2001-2016 David Capello
|
2012-08-06 04:17:29 +00:00
|
|
|
//
|
2014-03-29 23:08:05 +00:00
|
|
|
// This file is released under the terms of the MIT license.
|
|
|
|
// Read LICENSE.txt for more information.
|
2012-08-06 04:17:29 +00:00
|
|
|
|
|
|
|
#ifndef UI_OVERLAY_H_INCLUDED
|
|
|
|
#define UI_OVERLAY_H_INCLUDED
|
2014-03-29 22:40:17 +00:00
|
|
|
#pragma once
|
2012-08-06 04:17:29 +00:00
|
|
|
|
2020-07-07 22:06:48 +00:00
|
|
|
#include "base/ref.h"
|
2012-08-06 04:17:29 +00:00
|
|
|
#include "gfx/fwd.h"
|
|
|
|
#include "gfx/point.h"
|
2020-07-07 22:06:48 +00:00
|
|
|
#include "os/surface.h"
|
2012-08-06 04:17:29 +00:00
|
|
|
#include "ui/base.h"
|
|
|
|
|
2018-08-09 15:58:43 +00:00
|
|
|
namespace os {
|
2012-08-06 04:17:29 +00:00
|
|
|
class Surface;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
2020-07-07 22:06:48 +00:00
|
|
|
class Overlay;
|
|
|
|
using OverlayRef = base::Ref<Overlay>;
|
2012-08-11 02:14:54 +00:00
|
|
|
|
2020-07-07 22:06:48 +00:00
|
|
|
class Overlay : public base::RefCountT<Overlay> {
|
|
|
|
public:
|
|
|
|
enum ZOrder {
|
|
|
|
NormalZOrder = 0,
|
|
|
|
MouseZOrder = 5000
|
|
|
|
};
|
|
|
|
|
|
|
|
Overlay(const os::SurfaceRef& overlaySurface,
|
|
|
|
const gfx::Point& pos,
|
|
|
|
ZOrder zorder = NormalZOrder);
|
2012-08-06 04:17:29 +00:00
|
|
|
~Overlay();
|
|
|
|
|
2020-07-07 22:06:48 +00:00
|
|
|
os::SurfaceRef setSurface(const os::SurfaceRef& newSurface);
|
2012-08-11 02:14:54 +00:00
|
|
|
|
Refactor several "getNoun()" getters to "noun()"
This is a work-in-progress to create a consistent API and finally
separate the whole Aseprite base/gfx/ui libs into a reusable C++ library.
Classes:
app::IFileItem, app::AppMenuItem, app::skin::SkinPart,
gfx::Rect, gfx::Border, she::FileDialog,
ui::IButtonIcon, ui::Graphics, ui::Overlay, ui::Widget,
ui::ScrollableViewDelegate, and UI events
2015-12-04 17:39:04 +00:00
|
|
|
const gfx::Point& position() const { return m_pos; }
|
|
|
|
gfx::Rect bounds() const;
|
2012-08-06 04:17:29 +00:00
|
|
|
|
2018-08-09 15:58:43 +00:00
|
|
|
void captureOverlappedArea(os::Surface* screen);
|
2018-11-15 18:42:50 +00:00
|
|
|
void restoreOverlappedArea(const gfx::Rect& restoreBounds);
|
2012-08-06 04:17:29 +00:00
|
|
|
|
2018-11-15 18:42:50 +00:00
|
|
|
void drawOverlay();
|
2012-08-06 04:17:29 +00:00
|
|
|
void moveOverlay(const gfx::Point& newPos);
|
|
|
|
|
|
|
|
bool operator<(const Overlay& other) const {
|
|
|
|
return m_zorder < other.m_zorder;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2020-07-07 22:06:48 +00:00
|
|
|
os::SurfaceRef m_surface;
|
|
|
|
os::SurfaceRef m_overlap;
|
2018-11-15 18:42:50 +00:00
|
|
|
|
|
|
|
// Surface where we captured the overlapped (m_overlap)
|
|
|
|
// region. It's nullptr if the overlay wasn't drawn yet.
|
|
|
|
os::Surface* m_captured;
|
|
|
|
|
2012-08-06 04:17:29 +00:00
|
|
|
gfx::Point m_pos;
|
|
|
|
ZOrder m_zorder;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ui
|
|
|
|
|
|
|
|
#endif
|