这个类作为所有消息的基类,主要是包装了回调函数 virtual void messageCallback() = 0;

/*
============================================================================== This file is part of the JUCE library.
Copyright (c) 2015 - ROLI Ltd. Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information. ==============================================================================
*/ #ifndef JUCE_CALLBACKMESSAGE_H_INCLUDED
#define JUCE_CALLBACKMESSAGE_H_INCLUDED //==============================================================================
/**
A message that invokes a callback method when it gets delivered. You can use this class to fire off actions that you want to be performed later
on the message thread. To use it, create a subclass of CallbackMessage which implements the messageCallback()
method, then call post() to dispatch it. The event thread will then invoke your
messageCallback() method later on, and will automatically delete the message object
afterwards. Always create a new instance of a CallbackMessage on the heap, as it will be
deleted automatically after the message has been delivered. @see MessageManager, MessageListener, ActionListener, ChangeListener
*/
class JUCE_API CallbackMessage : public MessageManager::MessageBase
{
public:
//==============================================================================
CallbackMessage() noexcept {} /** Destructor. */
~CallbackMessage() {} //==============================================================================
/** Called when the message is delivered. You should implement this method and make it do whatever action you want
to perform. Note that like all other messages, this object will be deleted immediately
after this method has been invoked.
*/
virtual void messageCallback() = 0; private:
// Avoid the leak-detector because for plugins, the host can unload our DLL with undelivered
// messages still in the system event queue. These aren't harmful, but can cause annoying assertions.
JUCE_DECLARE_NON_COPYABLE (CallbackMessage)
}; #endif // JUCE_CALLBACKMESSAGE_H_INCLUDED

  

juce中的CallbackMessage的更多相关文章

  1. juce中的BailOutChecker

    界面库中值得注意的一点就是对象响应事件的时候自身被删除了,那么后续的访问自然就会出问题,所以需要在响应事件之后先添加引用,相关处理之后再查看自身是否已经被删除,如果已经被删除那么就直接退出.juce中 ...

  2. juce 中的WeakReference分析

    juce中的WeakReference设计得比较巧妙,巧妙就是使用delete之后就可以通知道WeakReference,原理其实也很间单,其实就是在对象里添加了一个子对象masterReferenc ...

  3. juce中的timer

    juce中timer总体说还是比较好用的,使用时只需继承timer类, 重写callback然后调用start就可以了,juce的timer比较特别,自己通过线程实现,starttimer的时候会创建 ...

  4. juce中的引用计数

    这个类提供了最基本的引用计数管理,界面库中,经常都需要消息发送,而带来的后果就是不知道消息中包含的对象是否还存在,如果不能很好管理的话就容易出现访问销毁了的对象这样的情况,所以,juce的界面无素也基 ...

  5. juce中的内存泄漏检测

    非常值得借鉴的做法,基于引用计数和局部静态变量,代码比较简单不加详解. //============================================================== ...

  6. juce中的Singleton

    说明上其实很明白,支持多线程,防止重复创建,同时支持如果删除以后就不在创建,利用局部静态变量进行标记.挺通用,看来下次写个c11版本的 //============================== ...

  7. juce 中的ReferenceCountedObjectPtr

    提供了对引用计数对象的管理,其实也就是操作引用计数对象,当引用计数为零的时候将对象销毁,值得学习的是juce是如果将引用计数对象和它的智能指针结合在一起的,这个后面再加分析 //=========== ...

  8. 一起学JUCE之HashMap

    基于哈希表的 Map 接口的实现.此实现提供所有可选的映射操作,并允许使用 null 值和 null 键.(除了非同步和允许使用 null 之外,HashMap 类与 Hashtable 大致相同.) ...

  9. Python开源框架

    info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...

随机推荐

  1. C#中静态与非静态方法比较【转】

    C#静态方法与非静态方法的区别不仅仅是概念上的,那么他们有什么具体的区别呢?让我们通过本文向你做一下解析. C#的类中可以包含两种方法:C#静态方法与非静态方法.那么他们的定义有什么不同呢?他们在使用 ...

  2. 黑马程序员_<<Set,HashSet>>

    --------------------ASP.Net+Android+IOS开发..Net培训.期待与您交流! -------------------- 1.Set Set是Collection接口 ...

  3. 动态代理双剑客--JDK Proxy与CGLIB

    背景: 研究过设计模式的同胞们都知道代理模式可以有两种实现方案: 1.接口实现(或继承抽象类) 核心代码片段 ProxySubject-->>doOperation() //dosomet ...

  4. EK中fromCharCode和parseInt的配合使用

    基于web的漏洞攻击的第一步一般是:在landing page中通过<script>标签下的JavaScript脚本引入一些恶意链接.这些脚本往往会採用各种各样的混淆.加密手法来躲避AV和 ...

  5. 初学IHttpModule的处理

    //集成IRequiresSessionState和IReadOnlySessionState是为了在类中访问session public class ModuleBase : IHttpModule ...

  6. Erp第二章:业务流程化、集成、规划

    1从全流程着眼,支持业务流程化优化,通过流程化优化提高工作效率和企业效益 2每个系统业务都相互依存.相互作用. 3.应用 程序(不用厂家)越多,信息集成难度越大 4信息集成.实时共享.实时企业 5信息 ...

  7. 在 Parallels Desktop 中,全屏模式使用 Win7,唤醒时黑屏

    在Parallels Desktop中,全屏模式下使用Win7,如果Mac电脑自动休眠了,则无法再次唤醒了,唤醒时黑屏. 博主的Mac是2014款MBPR,键盘上所有的键都试过,还是无法唤醒电脑,每次 ...

  8. Import MySQL Dumpfile, SQL Datafile Into My Database

    How can I import a MySQL dumpfile into my database? I'm using CentOS Linux 5 server. My old hosting ...

  9. UIButton 头文件常见属性和方法

    UIButton头文件常见属性 1.属性 contentEdgeInsets: default is UIEdgeInsetsZero.设置内容四边距,默认边距为0 @property(nonatom ...

  10. GitBook是一个命令行工具(Node.js库),我们可以借用该工具使用Github/Git和Markdown来制作精美的图书,但它并不是一本关于Git的教程哟。

    GitBook是一个命令行工具(Node.js库),我们可以借用该工具使用Github/Git和Markdown来制作精美的图书,但它并不是一本关于Git的教程哟. 支持输出多种格式 GitBook支 ...