MorePalmOS
A development library for developing Palm OS applications

MoreControl.c

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 
00017 #include "MorePrefix.h"
00018 #include "MoreControl.h"
00019 #include "MoreForm.h"
00020 #include "MorePrivate.h"
00021 
00022 #if !MOREPALMOS_MACRO_SIMPLE_FUNCS
00023 
00024 //-----------------------------------------------------------------------------
00025 
00026 ControlType* MCtlGetPtrByIdx( const FormType* formP, FrmObjectIdx_t idx )
00027 {
00028         return ( ControlType* ) MFrmGetObjPtrByIdx( formP, idx );
00029 }
00030 
00031 ControlType* MCtlGetPtrByID( const FormType* formP, FrmObjectID_t id )
00032 {
00033         return ( ControlType* ) MFrmGetObjPtrByID( formP, id );
00034 }
00035 
00036 ControlType* MCtlGetPtrByObjPtr( FrmObject_t* objectP )
00037 {
00038         return ( ControlType* ) ( objectP );
00039 }
00040 
00041 //-----------------------------------------------------------------------------
00042 
00043 ControlType* MCtlGetPtrByIdxSafely( const FormType* formP, FrmObjectIdx_t idx )
00044 {
00045         return ( ControlType* ) MFrmGetObjPtrOfTypeByIdx( formP, idx, frmControlObj );
00046 }
00047 
00048 ControlType* MCtlGetPtrByIDSafely( const FormType* formP, FrmObjectID_t id )
00049 {
00050         return ( ControlType* ) MFrmGetObjPtrOfTypeByID( formP, id, frmControlObj );
00051 }
00052 
00053 ControlType* MCtlGetPtrByObjPtrSafely( const FormType* formP, FrmObject_t* objectP )
00054 {
00055         return ( ControlType* ) MFrmGetObjPtrOfTypeByPtr( formP, objectP, frmControlObj );
00056 }
00057 
00058 //-----------------------------------------------------------------------------
00059 
00060 Boolean MCtlGetEnabledByID( const FormType* formP, FrmObjectID_t id )
00061 {
00062         return CtlEnabled( MCtlGetPtrByID( formP, id ) );
00063 }
00064 
00065 Boolean MCtlGetEnabledByIdx( const FormType* formP, FrmObjectIdx_t idx )
00066 {
00067         return CtlEnabled( MCtlGetPtrByIdx( formP, idx ) );
00068 }
00069 
00070 Boolean MCtlGetEnabledByPtr( ControlType* controlP )
00071 {
00072         return CtlEnabled( controlP );
00073 }
00074 
00075 //-----------------------------------------------------------------------------
00076 
00077 void MCtlSetEnabledByID( const FormType* formP, FrmObjectID_t id, Boolean enabled )
00078 {
00079         CtlSetEnabled( MCtlGetPtrByID( formP, id ), enabled );
00080 }
00081 
00082 void MCtlSetEnabledByIdx( const FormType* formP, FrmObjectIdx_t idx, Boolean enabled )
00083 {
00084         CtlSetEnabled( MCtlGetPtrByIdx( formP, idx ), enabled );
00085 }
00086 
00087 void MCtlSetEnabled( ControlType* controlP, Boolean enabled )
00088 {
00089         CtlSetEnabled( controlP, enabled );
00090 }
00091 
00092 //-----------------------------------------------------------------------------
00093 
00094 CtlValue_t MCtlGetValueByID( const FormType* formP, FrmObjectID_t id )
00095 {
00096         return CtlGetValue( MCtlGetPtrByID( formP, id ) );
00097 }
00098 
00099 CtlValue_t MCtlGetValueByIdx( const FormType* formP, FrmObjectIdx_t idx )
00100 {
00101         return CtlGetValue( MCtlGetPtrByID( formP, idx ) );
00102 }
00103 
00104 CtlValue_t MCtlGetValue( ControlType* controlP )
00105 {
00106         return CtlGetValue( controlP );
00107 }
00108 
00109 //-----------------------------------------------------------------------------
00110 
00111 void MCtlSetValueByID( FormType* formP, FrmObjectID_t id, CtlValue_t value )
00112 {
00113         CtlSetValue( MCtlGetPtrByID( formP, id ), value );
00114 }
00115 
00116 void MCtlSetValueByIdx( FormType* formP, FrmObjectIdx_t idx, CtlValue_t value )
00117 {
00118         CtlSetValue( MCtlGetPtrByID( formP, idx ), value );
00119 }
00120 
00121 void MCtlSetValue( ControlType* ctrlP, CtlValue_t value )
00122 {
00123         CtlSetValue( ctrlP, value );
00124 }
00125 
00126 //-----------------------------------------------------------------------------
00127 
00128 void MCtlCopyValueByID( FormType* formP, FrmObjectID_t srcID, FrmObjectID_t dstID )
00129 {
00130         MCtlSetValueByID( formP, dstID, MCtlGetValueByID( formP, srcID ) );
00131 }
00132 
00133 void MCtlCopyValueByIdx( FormType* formP, FrmObjectIdx_t srcIdx, FrmObjectIdx_t dstIdx )
00134 {
00135         MCtlSetValueByIdx( formP, dstIdx, MCtlGetValueByID( formP, srcIdx ) );
00136 }
00137 
00138 void MCtlCopyValue( ControlType* srcCtrlP, ControlType* dstCtrlP )
00139 {
00140         CtlSetValue( dstCtrlP, CtlGetValue( srcCtrlP ) );
00141 }
00142 
00143 #endif

SourceForge.net Logo