这个类作为所有消息的基类,主要是包装了回调函数 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. 关于Windows的139和445端口

    上次的月赛中,遇到了一个经典的MS08-067的漏洞,这是一个经典的教科书的漏洞.但是仅限于使用metasploit来攻击这个漏洞.现在我想简单写一些关于139和445端口的东西. 首先提到的是Net ...

  2. 深入理解JVM : Java垃圾收集器

    如果说收集算法是内存回收的方法论,那么垃圾收集器就是内存回收的具体实现. Java虚拟机规范中对垃圾收集器应该如何实现并没有任何规定,因此不同的厂商.不同版本的虚拟机所提供的垃圾收集器都可能会有很大差 ...

  3. 总结PHP中几种常用的网页跳转代码

    网页跳转的意思就是指当你在浏览器中访问A页面时,会自动跳转到B页面,往往网页跳转用在404页面中会比较多点.至于怎么实现网页跳转,网上已经提供了很多的方法,有些方法是不可行的,经过测试,叶德华今天就在 ...

  4. zendStudio安装Xdebug项目断点调试

    1,首先安装xdebug插件 传送门 2,配置php.ini文件如下: [XDebug] xdebug.profiler_append = xdebug.profiler_enable = xdebu ...

  5. GetProcessIdOfThread在WinXP及之前操作系统的替代实现

    还是学习VLD2.X版本看到的: 在Windows XP及之前的操作系统没有提供GetProcessIdOfThread的API,这里给出了一个替代的实现方式: 头文件: #if _WIN32_WIN ...

  6. 万事开头难——Cocos2d-x学习历程(一)

    万事开头难,不知该从哪里开始,不过既然要学习一样新东西,那就从了解它开始吧... Cocos2d-x是一个通用平面游戏引擎,基于一个同样十分著名的游戏引擎Cocos2d-iPhone设计,Cocos2 ...

  7. ZRender源码分析5:Shape绘图详解

    回顾 上一篇说到:ZRender源码分析4:Painter(View层)-中,这次,来补充一下具体的shape 关于热区的边框 以圆形为例: document.addEventListener('DO ...

  8. Python 自带IDLE中调试程序

    在vs2013下调试过Python,今天试了下使用自带IDLE调试,相比而言后者效果不好. 记录一下 http://q.cnblogs.com/q/35869/ 在“Python Shell”窗口中单 ...

  9. Transfer learning across two sentiment classes using deep learning

    用深度学习的跨情感分类的迁移学习 情感分析主要用于预测人们在自然语言中表达的思想和情感. 摘要部分:two types of sentiment:sentiment polarity and poli ...

  10. 使用pymysql和paramiko实现远程安装软件

    通过pymysql模块调用数据库获取安装信息,通过paramiko模块远程传输脚本并执行来安装软件,本文以安装apache为例. 创建apache安装信息数据表install_apache,设定三个字 ...