aseprite/src/ui/overlay.h
David Capello c42c5e1453 Backport new laf API to main branch of aseprite
Some features from the beta branch of aseprite & laf were backported
to the main branch of aseprite.

Related commits:
- New memory handling (db4504e816)
- New get event with timeout (e6ec13cc31)
- Convert os::NativeCursor to an enum (06a5b4f3ae)
- Adapt code to the new os::Display -> os::Window refactor (5d31314cdb)
- Save/load main window layout correctly and limit to current workarea (d6acb9e20f)
- Redraw window immediately on "live resizing" (d0b39ebade)
2021-07-05 17:51:29 -03:00

69 lines
1.5 KiB
C++

// Aseprite UI Library
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef UI_OVERLAY_H_INCLUDED
#define UI_OVERLAY_H_INCLUDED
#pragma once
#include "base/ref.h"
#include "gfx/fwd.h"
#include "gfx/point.h"
#include "os/surface.h"
#include "ui/base.h"
namespace os {
class Surface;
}
namespace ui {
class Overlay;
using OverlayRef = base::Ref<Overlay>;
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);
~Overlay();
os::SurfaceRef setSurface(const os::SurfaceRef& newSurface);
const gfx::Point& position() const { return m_pos; }
gfx::Rect bounds() const;
void captureOverlappedArea(os::Surface* screen);
void restoreOverlappedArea(const gfx::Rect& restoreBounds);
void drawOverlay();
void moveOverlay(const gfx::Point& newPos);
bool operator<(const Overlay& other) const {
return m_zorder < other.m_zorder;
}
private:
os::SurfaceRef m_surface;
os::SurfaceRef m_overlap;
// Surface where we captured the overlapped (m_overlap)
// region. It's nullptr if the overlay wasn't drawn yet.
os::Surface* m_captured;
gfx::Point m_pos;
ZOrder m_zorder;
};
} // namespace ui
#endif