Generated reference › API — ICoreSDK/ICoreStudio/StudioObjects/Panels/NotificationMessages
kind: generated#api#icoresdk-icorestudio-studioobjects-panels-notificationmessages

API — ICoreSDK/ICoreStudio/StudioObjects/Panels/NotificationMessages

The public contract of 4 header(s) under src/ICoreSDK/ICoreStudio/StudioObjects/Panels/NotificationMessages — 4 class/struct definition(s), 35 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreNotificationCenter.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/NotificationMessages/ICoreNotificationCenter.h

ICoreNotificationCenter#

ICoreNotificationCenter.h:20 · class · nested NotificationRecord · 11 declaration(s)

Routes notifications to every Run Diagnosis launcher on screen.

class ICoreNotificationCenter {
public:
    // One notification as it was logged, kept after its bubble is gone.
    struct NotificationRecord {
        std::string title;
        std::string message;
        bool err = false;
        bool warning = false;
        ICoreDateTime time;
    };

    // How many past notifications the history holds. Once it is full, logging a
    // new one drops the oldest.
    static constexpr size_t maxNotificationHistory = 50;

    static long initializeNotificationCenter();

    static void logFriendlyNotification(const std::string &title, const std::string &message);
    static void logWarningNotification(const std::string &title, const std::string &message);
    static void logSoftwareLevelErrorNotification(const std::string& title, const std::string& message);

    // Everything logged this session that has not yet been pushed out by a newer
    // message, oldest first. A message is recorded once, when it is logged —
    // including one raised before any window existed, which is recorded then and
    // not again when it is finally spoken.
    //
    // GUI thread only: history is written on the GUI thread after a background
    // caller's notification has been marshalled there.
    static const std::deque<NotificationRecord>& getNotificationHistory();
    static void clearNotificationHistory();

    // Announces that the notification history changed. The center is a static
    // utility with no instance, so the signal is a static of its own. Prefer
    // subscribeToHistory below, which also applies once immediately.
    static ICoreSignal<>& historyChanged();

    // Re-read the history whenever it changes. Mirrors ICoreThemeBinding::subscribe:
    // apply runs once immediately, and the subscription is owned by `owner`, so it
    // dies with the view and never fires into a dangling `this`.
    //
    //     ICoreNotificationCenter::subscribeToHistory(m_signals, [this] { rebuild(); });
    template <typename ApplyFn>
    static void subscribeToHistory(const ICoreSignalScope& owner, ApplyFn apply) {
        apply();
        historyChanged().connect(owner, apply);
    }

    static void registerStack(ICoreNotificationStack* stack);
    static void unregisterStack(ICoreNotificationStack* stack);

    // A GUI-thread widget for callers that only need somewhere to marshal to.
    // It is not a parent for notification UI — the stacks are.
    static ICoreWidget* getNotificationCenterUI();

};

ICoreNotificationCenterMessageBox.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/NotificationMessages/ICoreNotificationCenterMessageBox.h

ICoreNotificationCenterMessageBox#

ICoreNotificationCenterMessageBox.h:27 · class · bases public ICoreWidget · pImpl · 14 declaration(s)

One utterance from the Run Diagnosis launcher.

class ICoreNotificationCenterMessageBox : public ICoreWidget {
public:
    // The parent is spelled as "some widget": ICoreStudioGarbageRecycling
    // (outside this cluster) hands one in that it did not create, so there is
    // nothing narrower for it to pass.
    explicit ICoreNotificationCenterMessageBox(ICoreNativeWidget* parent = nullptr,
        const std::string& title = "Message", const std::string& message = "");

    void animateShow(const bool& err, const bool& warning);

    // The column this bubble belongs to. Dismissal and unfolding are reported
    // to it rather than to the center, because several stacks now show the same
    // message and each has to re-measure only itself.
    void setOwner(ICoreNotificationStack* owner);

    void resetToInitialState(ICoreNativeWidget* parent = nullptr, const std::string& title = "Message", const std::string& message = "");

    // The tail costs vertical room, so toggling it re-lays the bubble out.
    void setHasTail(bool hasTail);

    // Height the bubble settles at once it has finished unfolding. The stack
    // asks for this rather than height(), which is mid-animation for one frame
    // out of every new message.
    int unfoldedHeight() const;

    // The height the bubble is asking its column for — the current animation
    // frame while it unfolds, the settled height afterwards.
    //
    // Normally the same as height(), but it is what the bubble wants rather than
    // what it was last given: if the column ever comes up short and its layout
    // squeezes a bubble, summing these grows the column back instead of taking
    // the squeezed height as the new truth.
    int requestedHeight() const;

    void kill();
    void setAlive();
    bool isAlive() const;

    ~ICoreNotificationCenterMessageBox() override;

protected:
    void paintContent(ICorePainter& painter) override;

    // The bubble is a button in everything but name, so it answers the pointer
    // the way the launcher does: the rim it already wears comes up to the same
    // intensity the chip's hover rim reaches, over a ground that lifts with it.
    void pointerEntered() override;
    void pointerLeft() override;

    // The dismiss button takes the pointer for itself, and the toolkit reports
    // that to the bubble as a leave. Watching the button is how the bubble tells
    // "gone to my own dismiss" apart from "gone".

    // Clicking the bubble opens the log. A bubble is a glimpse of one message on
    // its way past; the click is how you get from it to the record of all of
    // them, including whatever expired before you looked over.
    //
    // The dismiss button is a child and swallows its own clicks, so it does not
    // arrive here — closing a bubble still just closes it.
    bool mousePressed(const ICoreMouseEvent& event) override;

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreNotificationHistoryPanel.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/NotificationMessages/ICoreNotificationHistoryPanel.h

ICoreNotificationHistoryPanel#

ICoreNotificationHistoryPanel.h:26 · class · final · bases public ICoreWidget · pImpl · 2 declaration(s)

The log behind the bubbles: everything ICoreNotificationCenter still holds in its history, newest first.

class ICoreNotificationHistoryPanel final : public ICoreWidget {
public:
    explicit ICoreNotificationHistoryPanel(ICoreWidget* parent = nullptr);

    ~ICoreNotificationHistoryPanel() override;

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreNotificationStack.h#

src/ICoreSDK/ICoreStudio/StudioObjects/Panels/NotificationMessages/ICoreNotificationStack.h

ICoreNotificationStack#

ICoreNotificationStack.h:22 · class · bases public ICoreWidget · pImpl · 8 declaration(s)

The column of bubbles one Run Diagnosis launcher speaks into.

class ICoreNotificationStack : public ICoreWidget {
public:
    // host is the window the bubbles live in; anchor is the launcher chip they
    // rise out of. The anchor need not be a direct child of the host.
    ICoreNotificationStack(ICoreWidget* host, ICoreWidget* anchor);

    // A bubble was clicked. Raised as a signal rather than acted on here: the
    // log is a page of the editor's right-hand panel, which this class — living
    // down in the registry — has no business knowing about. Whoever built the
    // stack owns that subscription.
    ICoreSignal<> historyRequested;

    void addMessage(const std::string& title, const std::string& message, bool err, bool warning);
    void removeMessage(ICoreNotificationCenterMessageBox* box);

    void requestHistory();

    // Re-measure the column and re-seat it over the launcher. Called on host
    // resize and on every frame of a bubble unfolding.
    void refreshGeometry();

    // The Run Diagnosis panel unfolds into exactly this space, so the stack
    // steps aside while it is open — the log is on screen anyway.
    void setSuppressed(bool suppressed);

    ~ICoreNotificationStack() override;

protected:
    // The column has to re-seat itself when the window it lives in is resized.
    void watchedResized(ICoreNativeWidget* watched, const ICoreSizeF& newSize) override;

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};