MorePalmOS
A development library for developing Palm OS applications

MoreControl.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * MorePalmOS
00003  * Copyright (c) 2004 Steven Fisher
00004  *
00005  * Distributed under the Boost Software License, Version 1.0. See accompanying
00006  * license file License.txt or <http://www.boost.org/LICENSE_1_0.txt>.
00007  *
00008  * http://morepalmos.sourceforge.net
00009  *
00010  *   MorePalmOS is the humble begining of an attempt to provide a library for
00011  *   Palm OS development which works around system bugs, illustrate how to
00012  *   use system calls, and provide "glue code" for programming Palm OS
00013  *   applications in a more straightforward way while minimally impacting
00014  *   code size.
00015  *****************************************************************************/
00016 
00022 #ifndef MORECONTROL_H
00023 #define MORECONTROL_H
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 #include "MorePrefix.h"
00030 
00031 #include "MoreTypes.h"
00032 
00033 #include <Control.h>
00034 #include <Form.h>
00035 
00039 #define MCtlCastToControlPtr( objectP ) ( ControlType* )( objectP )
00040 
00041 #if MOREPALMOS_MACRO_SIMPLE_FUNCS
00042 
00043         #define MCtlGetPtrByIdx( formP, idx )\
00044                 ( ControlType* )MFrmGetObjPtrByIdx( formP, idx, frmControlObj )
00045         #define MCtlGetPtrByID( formP, ID )\
00046                 ( ControlType* )MFrmGetObjPtrByID( formP, ID, frmControlObj )
00047         #define MCtlGetPtrByObjPtr( formP, ptr )\
00048                 ( ControlType* )( ptr )
00049 
00050         #define MCtlGetPtrByIdxSafely( formP, idx )\
00051                 ( ControlType* )MFrmGetObjPtrOfTypeByIdx( formP, idx, frmControlObj )
00052         #define MCtlGetPtrByIDSafely( formP, ID )\
00053                 ( ControlType* )MFrmGetObjPtrOfTypeByID( formP, ID, frmControlObj )
00054         #define MCtlGetPtrByObjPtrSafely( formP, ptr )\
00055                 ( ControlType* )MFrmGetObjPtrOfTypeByPtr( formP, ptr, frmControlObj )
00056 
00057         #define MCtlGetEnabledByIdx( formP, id )\
00058                 CtlEnabled( MCtlGetByIdx( formP, id ) )
00059         #define MCtlGetEnabledByID( formP, id )\
00060                 CtlEnabled( MCtlGetByID( formP, id ) )
00061         #define MCtlGetEnabledByPtr( ctrlP )\
00062                 CtlEnabled( ctrlP )
00063 
00064         #define MCtlSetEnabledByIdx( formP, ctrlIdx, enabled )\
00065                 CtlSetEnabled( MFrmGetObjPtrByIdx( formP, ctrlIdx ), enabled )
00066         #define MCtlSetEnabledByID( formP, ctrlID, enabled )\
00067                 CtlSetEnabled( MFrmGetObjPtrByIdx( formP, ctrlID ), enabled )
00068         #define MCtlSetEnabled( formP, ctrlP, enabled )\
00069                 CtlSetEnabled( ctrlP, enabled )
00070 
00071         #define MCtlGetValueByIdx( formP, id )\
00072                 CtlGetValue( MCtlGetByIdx( formP, id ) )
00073         #define MCtlGetValueByID( formP, id )\
00074                 CtlGetValue( MCtlGetByID( formP, id ) )
00075         #define MCtlGetValue( ctrlP )\
00076                 CtlGetValue( ctrlP )
00077 
00078         #define MCtlSetValueByIdx( formP, ctrlIdx, value )\
00079                 CtlSetValue( MFrmGetObjPtrByIdx( formP, ctrlIdx ), value )
00080         #define MCtlSetValueByID( formP, ctrlID, value )\
00081                 CtlSetValue( MFrmGetObjPtrByIdx( formP, ctrlID ), value )
00082         #define MCtlSetValue( formP, ctrlP, value )\
00083                 CtlSetValue( ctrlP, value )
00084 
00085         #define MCtlCopyValueByID( formP, srcP, dstP )\
00086                 {\
00087                         FormType* __macroFormP = formP;\
00088                         MCtlSetValueByIdx( __macroFormP, dstIdx,\
00089                                 MCtlGetValueByIdx( __macroFormP, srcIdx ) );\
00090                 }
00091         #define MCtlCopyValueByID( formP, srcID, dstID )\
00092                 {\
00093                         FormType* __macroFormP = formP;\
00094                         MCtlSetValueByID( __macroFormP, dstID,\
00095                                 MCtlGetValueByID( __macroFormP, srcID ) );\
00096                 }
00097         #define MCtlCopyValue( srcP, dstP )\
00098                 CtlSetValue( dstP, CtlGetValue( srcP ) )
00099 
00100 #else
00101 
00102 /*****************************************************************************/
00103 
00115 ControlType* MCtlGetPtrByIdxSafely( const FormType* formP, FrmObjectIdx_t idx );
00116 
00128 ControlType* MCtlGetPtrByIDSafely( const FormType* formP, FrmObjectID_t id );
00129 
00141 ControlType* MCtlGetPtrByObjPtrSafely( const FormType* formP, FrmObject_t* objectP );
00142 
00152 ControlType* MCtlGetPtrByIdx( const FormType* formP, FrmObjectIdx_t idx );
00153 
00163 ControlType* MCtlGetPtrByID( const FormType* formP, FrmObjectID_t id );
00164 
00174 ControlType* MCtlGetPtrByObjPtr( FrmObject_t* objectP );
00175 
00185 Boolean MCtlGetEnabledByIdx( const FormType* formP, FrmObjectIdx_t idx );
00186 
00196 Boolean MCtlGetEnabledByID( const FormType* formP, FrmObjectID_t id );
00197 
00206 Boolean MCtlGetEnabledByPtr( ControlType* controlP );
00207 
00208 /*****************************************************************************/
00209 
00219 void MCtlSetEnabledByID( const FormType* formP, FrmObjectID_t id, Boolean enabled );
00220 
00230 void MCtlSetEnabledByIdx( const FormType* formP, FrmObjectIdx_t idx, Boolean enabled );
00231 
00240 void MCtlSetEnabled( ControlType* controlP, Boolean enabled );
00241 
00242 /*****************************************************************************/
00243 
00252 CtlValue_t MCtlGetValueByID( const FormType* formP, FrmObjectID_t id );
00253 
00262 CtlValue_t MCtlGetValueByIdx( const FormType* formP, FrmObjectIdx_t idx );
00263 
00273 CtlValue_t MCtlGetValue( ControlType* ctrlP );
00274 
00275 /*****************************************************************************/
00276 
00286 void MCtlSetValueByID( FormType* formP, FrmObjectID_t id, CtlValue_t value );
00287 
00296 void MCtlSetValueByIdx( FormType* formP, FrmObjectIdx_t idx, CtlValue_t value );
00297 
00307 void MCtlSetValue( ControlType* ctrlP, CtlValue_t value );
00308 
00309 /*****************************************************************************/
00310 
00321 void MCtlCopyValueByID( FormType* formP, FrmObjectID_t srcID, FrmObjectID_t dstID );
00322 
00333 void MCtlCopyValueByIdx( FormType* formP, FrmObjectIdx_t srcIdx, FrmObjectIdx_t dstIdx );
00334 
00345 void MCtlCopyValue( ControlType* srcCtrlP, ControlType* dstCtrlP );
00346 #endif
00347 
00348 #ifdef __cplusplus
00349 }
00350 #endif
00351 
00352 #endif

SourceForge.net Logo