2013-08-08 21:01:20 -03:00
|
|
|
// Aseprite UI Library
|
2013-01-27 12:13:13 -03:00
|
|
|
// Copyright (C) 2001-2013 David Capello
|
2010-09-27 19:18:17 -03:00
|
|
|
//
|
2014-03-29 20:08:05 -03:00
|
|
|
// This file is released under the terms of the MIT license.
|
|
|
|
// Read LICENSE.txt for more information.
|
2010-03-07 16:10:48 -02:00
|
|
|
|
2012-07-08 23:24:42 -03:00
|
|
|
#ifndef UI_POPUP_WINDOW_H_INCLUDED
|
|
|
|
#define UI_POPUP_WINDOW_H_INCLUDED
|
2014-03-29 19:40:17 -03:00
|
|
|
#pragma once
|
2010-03-07 16:10:48 -02:00
|
|
|
|
2012-07-08 23:24:42 -03:00
|
|
|
#include "ui/window.h"
|
2010-03-07 16:10:48 -02:00
|
|
|
|
2012-06-17 22:02:54 -03:00
|
|
|
namespace ui {
|
|
|
|
|
2012-07-08 23:24:42 -03:00
|
|
|
class PopupWindow : public Window
|
2012-06-17 22:02:54 -03:00
|
|
|
{
|
|
|
|
public:
|
2014-04-13 19:25:06 -03:00
|
|
|
enum ClickBehavior {
|
|
|
|
kDoNothingOnClick,
|
|
|
|
kCloseOnClickInOtherWindow,
|
|
|
|
kCloseOnClickOutsideHotRegion
|
|
|
|
};
|
|
|
|
|
2014-04-20 19:53:27 -03:00
|
|
|
PopupWindow(const std::string& text, ClickBehavior clickBehavior);
|
2012-07-08 23:24:42 -03:00
|
|
|
~PopupWindow();
|
2012-06-17 22:02:54 -03:00
|
|
|
|
2013-01-13 22:39:44 -03:00
|
|
|
void setHotRegion(const gfx::Region& region);
|
2012-06-17 22:02:54 -03:00
|
|
|
|
|
|
|
void makeFloating();
|
|
|
|
void makeFixed();
|
|
|
|
|
|
|
|
protected:
|
2014-08-14 23:07:47 -03:00
|
|
|
bool onProcessMessage(Message* msg) override;
|
|
|
|
void onPreferredSize(PreferredSizeEvent& ev) override;
|
|
|
|
void onPaint(PaintEvent& ev) override;
|
|
|
|
void onInitTheme(InitThemeEvent& ev) override;
|
2012-06-17 22:02:54 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
void startFilteringMessages();
|
|
|
|
void stopFilteringMessages();
|
|
|
|
|
2014-04-13 19:25:06 -03:00
|
|
|
ClickBehavior m_clickBehavior;
|
2013-01-13 22:39:44 -03:00
|
|
|
gfx::Region m_hotRegion;
|
2012-06-17 22:02:54 -03:00
|
|
|
bool m_filtering;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ui
|
2010-03-07 16:10:48 -02:00
|
|
|
|
|
|
|
#endif
|