mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Some features from the beta branch of aseprite & laf were backported to the main branch of aseprite. Related commits: - New memory handling (db4504e816ffccf0ea63a78737ebb6e22cc0453b) - New get event with timeout (e6ec13cc31e6e689040bc651f98ee1752834d14c) - Convert os::NativeCursor to an enum (06a5b4f3aebfafb6363ea33d349975d6e419ca7b) - Adapt code to the new os::Display -> os::Window refactor (5d31314cdb23f314391e5eaebd7cea84f5179ac7) - Save/load main window layout correctly and limit to current workarea (d6acb9e20f11fda938959c99285fe4f7d7051794) - Redraw window immediately on "live resizing" (d0b39ebade7736d47e6b2450bf68b088c0da8e57)
58 lines
1.0 KiB
C++
58 lines
1.0 KiB
C++
// Aseprite UI Library
|
|
// Copyright (C) 2020-2021 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_TIMER_H_INCLUDED
|
|
#define UI_TIMER_H_INCLUDED
|
|
#pragma once
|
|
|
|
#include "base/disable_copying.h"
|
|
#include "base/time.h"
|
|
#include "obs/signal.h"
|
|
|
|
namespace ui {
|
|
|
|
class Widget;
|
|
|
|
class Timer {
|
|
public:
|
|
Timer(int interval, Widget* owner = nullptr);
|
|
virtual ~Timer();
|
|
|
|
int interval() const { return m_interval; }
|
|
void setInterval(int interval);
|
|
|
|
bool isRunning() const {
|
|
return m_running;
|
|
}
|
|
|
|
void start();
|
|
void stop();
|
|
|
|
void tick();
|
|
|
|
obs::signal<void()> Tick;
|
|
|
|
static void pollTimers();
|
|
static bool haveTimers();
|
|
static bool getNextTimeout(double& timeout);
|
|
|
|
protected:
|
|
virtual void onTick();
|
|
|
|
public:
|
|
Widget* m_owner;
|
|
int m_interval;
|
|
bool m_running;
|
|
base::tick_t m_lastTick;
|
|
|
|
DISABLE_COPYING(Timer);
|
|
};
|
|
|
|
} // namespace ui
|
|
|
|
#endif
|