Loading...
Searching...
No Matches
DialogRequest.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith.
2// Malena Framework — Licensed under PolyForm Noncommercial 1.0.0; commercial use requires a paid license. See LICENSE.
3
4#ifndef MALENA_DIALOGREQUEST_H
5#define MALENA_DIALOGREQUEST_H
6
7#pragma once
8
11#include <functional>
12#include <string>
13
14namespace ml
15{
16 class Core;
42 {
43 enum class Hook { SHOW };
44
45 virtual const std::string& getMessage() = 0;
46 virtual const std::string& getConfirmLabel() = 0;
47 virtual const std::string& getCancelLabel() = 0;
48 virtual std::function<void()> getOnConfirm() = 0;
49 virtual std::function<void()> getOnReject() = 0;
50
51 // Optional overrides — existing subclasses need no changes
52 virtual std::string getTitle() { return {}; }
53 virtual ml::Core* getContent() { return nullptr; }
54
55 // Preferred modal size for this dialog, or {0,0} to use the shell default.
56 // Lets a content-heavy dialog (e.g. a thumbnail grid) ask for a roomier panel.
57 virtual sf::Vector2f getPreferredSize() { return {0.f, 0.f}; }
58
59 virtual ~DialogRequest() = default;
60 };
61
62} // namespace ml
63
64#endif // MALENA_DIALOGREQUEST_H
Virtual base class for all Malena framework objects.
Definition Core.h:97
#define MALENA_API
Definition Animate.h:25
Vector2< float > Vector2f
Interface for components that want the root shell to present a confirm/cancel dialog on their behalf.
virtual const std::string & getMessage()=0
virtual const std::string & getCancelLabel()=0
virtual sf::Vector2f getPreferredSize()
virtual std::string getTitle()
virtual std::function< void()> getOnConfirm()=0
virtual ~DialogRequest()=default
virtual std::function< void()> getOnReject()=0
virtual ml::Core * getContent()
virtual const std::string & getConfirmLabel()=0