00001 /* 00002 Copyright 1996-2002 00003 Simon Whiteside, All Rights Reserved 00004 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 Demo_Controller.h 00021 00022 This file defines the interface for the class which controls the demo's view. 00023 00024 $Id: xml_2Demo__Controller_8h-source.html,v 1.5 2003/01/23 15:31:03 simkin_cvs Exp $ 00025 */ 00026 #ifndef CONTROLLER_H 00027 #define CONTROLLER_H 00028 00029 #include "skXMLExecutable.h" 00030 00031 #include "Demo_View.h" 00032 00033 class Controller : public skXMLExecutable, public ViewCallback 00034 // deriving from skXMLExecutable means we can be called from Simkin scripts 00035 // deriving from ViewCallback means we can get notified when 00036 // buttons are pressed on the view 00037 { 00038 public: 00039 Controller(const skString& fileName,skInterpreter * interp); 00040 ~Controller(); 00041 void buttonPressed(int id); 00042 bool method(const skString& s,skRValueArray& args,skRValue& ret,skExecutableContext& ctxt); 00043 private: 00044 void init(); 00045 skString getStringAttribute(DOM_Element elem,const skString& name); 00046 int getIntegerAttribute(DOM_Element elem,const skString& name); 00047 View * m_View; 00048 skString m_FileName; 00049 skInterpreter * m_Interpreter; 00050 }; 00051 00052 #endif