core/vgui/vgui_command.cxx
Go to the documentation of this file.
00001 // This is core/vgui/vgui_command.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author fsm
00008 // \brief  See vgui_command.h for a description of this file.
00009 
00010 #include "vgui_command.h"
00011 #include <vcl_iostream.h>
00012 
00013 //-----------------------------------------------------------------------------
00014 vgui_command::vgui_command()
00015 {
00016 #ifdef DEBUG
00017   vcl_cerr << "vgui_command ctor : " << (void*)this << '\n';
00018 #endif
00019 }
00020 
00021 vgui_command::~vgui_command()
00022 {
00023 #ifdef DEBUG
00024   vcl_cerr << "vgui_command dtor : " << (void*)this << '\n';
00025 #endif
00026 }
00027 
00028 //-----------------------------------------------------------------------------
00029 vgui_command_cfunc::vgui_command_cfunc(function_pv f, void const *d)
00030   : fn_pv(f)
00031   , fn(0)
00032   , data(d)
00033 {
00034 }
00035 
00036 //-----------------------------------------------------------------------------
00037 vgui_command_cfunc::vgui_command_cfunc(function f)
00038   : fn_pv(0)
00039   , fn(f)
00040   , data(0)
00041 {
00042 }
00043 
00044 //-----------------------------------------------------------------------------
00045 vgui_command_cfunc::~vgui_command_cfunc()
00046 {
00047 }
00048 
00049 //-----------------------------------------------------------------------------
00050 void vgui_command_cfunc::execute()
00051 {
00052   if (fn_pv)
00053     (*fn_pv)(data);
00054   else if (fn)
00055     (*fn)();
00056   else
00057     vcl_cerr << "vgui_command_cfunc : fn is null\n";
00058 }
00059 
00060 //-----------------------------------------------------------------------------
00061 vgui_command_toggle::~vgui_command_toggle()
00062 {
00063 }
00064 
00065 //-----------------------------------------------------------------------------
00066 void vgui_command_toggle::execute()
00067 {
00068 #ifdef DEBUG
00069   vcl_cerr << "\nvgui_command_toggle. old state : " << state;
00070 #endif
00071   state = !state;
00072 #ifdef DEBUG
00073   vcl_cerr << "; new state : " << state << ".\n\n";
00074 #endif
00075 }
00076