timer.cc

来自「QNX实时操作系统里的GUI是c格式的」· CC 代码 · 共 115 行

CC
115
字号
#if 0     Copyright (c) 2005-2006.        Written by Yakov Zaytsev. All rights reserved     Redistribution and use in source and binary forms, with or without   modification, are permitted provided that the following conditions   are met:   1. Redistributions of source code must retain the above copyright      notice, this list of conditions and the following disclaimer.   2. Redistributions in binary form must reproduce the above copyright      notice, this list of conditions and the following disclaimer in the      documentation and/or other materials provided with the distribution.   3. Neither the name of the author nor the names of its contributors      may be used to endorse or promote products derived from this software      without specific prior written permission.  #endif#include <iostream.h>#include <photon/PtTimer.h>#include <photonmm/Timer.h>static intev_timer_activate (PtWidget_t*, void* data, PtCallbackInfo_t* cbinfo){//      Slot1<void, Timer::Reason_Subtype>* slot = (Slot1<void, Timer::Reason_Subtype>*) data;        Slot0<void                       >* slot = (Slot0<void                       >*) data;//        (void) (*slot) (( cbinfo->reason_subtype == Pt_TIMER_INITIAL) ? Timer::TIMER_INITIAL : Timer::TIMER_REPEAT  );        (void) (*slot) (                                                                                            );        return Pt_CONTINUE;}void Timer::disable (){        set_timer_initial (0);//PtUnrealizeWidget (obj);}Timer::Timer (PtWidget_t* widget)        {                obj = widget;        }        void         Timer::set_timer_initial (unsigned long tim) // Pt_ARG_TIMER_INITIAL        {                PtSetResource (obj, Pt_ARG_TIMER_INITIAL, tim, 0);        }        unsigned long         Timer::get_timer_initial () const        {                unsigned long* c;                PtGetResource (obj, Pt_ARG_TIMER_INITIAL, &c, 0);                return *c;        }        void         Timer::set_timer_repeat (unsigned long tim) // Pt_ARG_TIMER_REPEAT        {                PtSetResource (obj, Pt_ARG_TIMER_REPEAT, tim, 0);        }        unsigned long         Timer::get_timer_repeat () const        {                unsigned long* c;                PtGetResource (obj, Pt_ARG_TIMER_REPEAT, &c, 0);                return *c;        }#if 0        SignalProxy<Slot1<void, Timer::Reason_Subtype> >         Timer::signal_timer_activate () // Pt_CB_TIMER_ACTIVATE        {                return SignalProxy<Slot1<void, Timer::Reason_Subtype> > ( new Callback<Slot1<void, Timer::Reason_Subtype> > (&ev_timer_activate, obj, Pt_CB_TIMER_ACTIVATE)  );                        }#endif        SignalProxy<Slot0<void                       > >         Timer::signal_timer_activate () // Pt_CB_TIMER_ACTIVATE        {                return SignalProxy<Slot0<void                      > > ( new Callback<Slot0<void                       > > (&ev_timer_activate, obj, Pt_CB_TIMER_ACTIVATE)  );                        }        PropertyProxy<unsigned long>         Timer::property_timer_initial () // Pt_ARG_TIMER_INITIAL        {                                return PropertyProxy<unsigned long> (  new Property<unsigned long, Timer, &Timer::get_timer_initial, &Timer::set_timer_initial> (this));        }        PropertyProxy<unsigned long>         Timer::property_timer_repeat () // Pt_ARG_TIMER_REPEAT        {                                return PropertyProxy<unsigned long> (  new Property<unsigned long, Timer, &Timer::get_timer_repeat, &Timer::set_timer_repeat> (this));        }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?