Module Dfrad_mx.pkg

     1//  Define Mixin group Class
     2//      DfRadio_group_Mixin
     3//
     4// Group Interface
     5//   Get/Set Current_Radio
     6//   Get/Set Radio_Value
     7//   Get/Set Radio_Shadow_State  item# to state
     8//   Get     Radio_Object        item# to Obj#
     9//   Get     Radio_Object_Item   Obj#  to item#
    10//   Get     Radio_Count               to #items
    11//   Get/Set Current_Radio_Object      to obj#
    12//   Get/Set Changed_State             to state
    13//   Set     Shadow_Sta                to state
    14//
    15//   Send Notify_Select_State (only for augmentation - do not send)
    16//
    17// Button Interface
    18//   Set Location
    19//   Set Size (it autosizes)
    20//   Set Label (can also use parent's Radio_Label)
    21//   Set Status_Help
    22//   Set Select_State
    23//   Set Shadow_State (can also use parent's Radio_Shadow_State)
    24//   Note: Status help for radios will use parent if no help is provided
    25//         for the radio object
    26//
    27Use VdfBase.pkg
    28
    29Class DFRadio_Group_Mixin is a Mixin
    30  { Visibility=Private }
    31  Procedure Define_DfRadio_Group_Mixin
    32     { Visibility=Private }
    33     Property Integer Private.Current_Radio_Object 0
    34
    35     { Visibility=Private }
    36     Property Integer Private.Current_Radio       -1
    37
    38     { Visibility=Private }
    39     Property Integer In_Group_State            false
    40
    41     { DesignTime=False }
    42     { PropertyType=Boolean }
    43     Property Integer Changed_State             False
    44     //
    45     Object Radio_Objects is an Array
    46     End_Object
    47     //
    48     Set Client_Area_State to False
    49     Set Ring_State to TRUE
    50  End_Procedure //
    51
    52  { MethodType=Event Visibility=Private }
    53  Procedure Private.Notify_Select_State integer Newobj integer itemNo
    54     Integer NewItem OldItem OldObj
    55     Get Current_Radio to OldItem
    56     Get Radio_Object_Item NewObj to NewItem
    57     If NewItem ne OldItem Begin
    58        Get Current_Radio_Object to OldObj
    59        If OldObj ;
    60           Set Select_State of OldObj item 0 to FALSE
    61        Set Private.Current_Radio_Object to NewObj
    62        Set Private.Current_Radio   to NewItem
    63        Send Notify_select_State NewItem OldItem
    64     End
    65  End_procedure
    66
    67  { MethodType=Event }
    68  Procedure Notify_Select_State integer NewId  integer OldId
    69  End_procedure
    70
    71  { MethodType=Property }
    72  Procedure Set Current_Radio integer Item#
    73     integer Obj
    74     Get Radio_Object item Item# to Obj
    75     If Obj ;
    76        Set Current_Radio_Object to Obj
    77  End_procedure
    78
    79  { MethodType=Property }
    80  Procedure Set Current_Radio_Object integer Obj#
    81     integer OldObj
    82     Get Current_Radio_Object to OldObj
    83     Set Select_State of Obj# item 0 to True
    84     If (focus(desktop)=OldObj) ;
    85        Send Activate
    86  End_procedure
    87
    88  { MethodType=Property }
    89  Function Current_Radio returns Integer
    90     Function_Return (Private.Current_Radio(self))
    91  End_Function
    92
    93  { MethodType=Property }
    94  Function Current_Radio_Object returns Integer
    95     Function_Return (Private.Current_Radio_Object(self))
    96  End_Function
    97
    98  { Visibility=Private }
    99  Procedure Register_Radio_Object Integer Obj#
   100    Integer ArrObj Itm
   101    Move (Radio_Objects(self)) to ArrObj
   102    Get Item_Count  of ArrObj to Itm
   103    Set array_value of ArrObj item itm to Obj#
   104  End_Procedure
   105
   106  { MethodType=Property }
   107  Function Radio_Count Returns integer
   108    Integer Itm
   109    Get Item_Count of (Radio_Objects(self)) to Itm
   110    Function_return Itm
   111  End_Function
   112
   113  Function Radio_Object_Item integer RObj returns integer
   114     integer item# ItmCnt
   115     Integer Obj
   116     If Robj Begin
   117        Move (Radio_Objects(self)) to Obj
   118        Get Item_Count of Obj to ItmCnt
   119        Decrement ItmCnt
   120        For Item# from 0 to ItmCnt
   121            If (Integer_Value(Obj,Item#)=RObj) ;
   122                Function_return Item#
   123        Loop
   124     End
   125     Function_Return -1
   126  End_Function
   127
   128  Function Radio_Object integer Item# Returns Integer
   129    Integer RObj
   130    Get Integer_Value of (Radio_Objects(self)) item Item# to RObj
   131    Function_Return RObj
   132  End_Function
   133
   134  { MethodType=Property }
   135  Procedure Set Radio_Value integer Item# String RValue
   136    Integer RObj
   137    Get Radio_Object item Item# to rObj
   138    If Robj ;
   139       Set Label of RObj to RValue
   140  End_Procedure
   141
   142  { MethodType=Property }
   143  Function Radio_Value integer Item# Returns String
   144    Integer RObj
   145    Get Radio_Object item Item# to rObj
   146    If Robj ;
   147       Function_Return (Label(Robj))
   148  End_Function
   149
   150  { MethodType=Property Visibility=Private }
   151  Procedure Set Radio_Shadow_State integer Item# Integer iState
   152    Integer RObj
   153    Get Radio_Object item Item# to rObj
   154    If Robj ;
   155       Set Object_Shadow_State of RObj to iState
   156  End_Procedure
   157
   158  { MethodType=Property Visibility=Private }
   159  Function Radio_Shadow_State integer Item# Returns Integer
   160    Integer RObj
   161    Get Radio_Object item Item# to rObj
   162    If Robj ;
   163       Function_Return (Object_Shadow_State(Robj))
   164  End_Function
   165
   166  { NoDoc=True }
   167    Procedure Add_Focus Handle hoParent Returns Integer
   168     integer rVal
   169     Forward Get MSG_Add_Focus hoParent to rVal
   170     if not rVal Begin
   171        broadcast NO_STOP send add_focus self
   172        If (Current_Radio_Object(self)=0) ;
   173           Set Current_Radio to 0
   174     end
   175  End_Procedure
   176
   177  { NoDoc=True }
   178  Procedure Activate returns integer
   179     Integer rVal Obj
   180     If (Object_Shadow_State(self)) Procedure_Return ERROR_ENTERING
   181     Set In_Group_State to True
   182     If Not (Active_State(self)) ;
   183        Send Add_Focus (focus(desktop))
   184     Send Rotate_up
   185     get Current_radio_Object to Obj
   186     If Obj eq 0 ;
   187        Get Radio_Object 0 to Obj
   188     If Obj Get Msg_Activate of Obj to Rval
   189     Else move 1 to rVal
   190     Set In_Group_State to False
   191     Procedure_Return rVal
   192  End_Procedure // Activate
   193
   194  { MethodType=Event  NoDoc=True }
   195  Procedure Mouse_Down Integer iWindowNumber Integer iPosition
   196  End_Procedure // Mouse_down
   197
   198  { MethodType=Event   NoDoc=True }
   199  Procedure Mouse_Click Integer iWindowNumber Integer iPosition
   200  End_Procedure // Mouse_Click
   201
   202  { Visibility=Private }
   203  Procedure Update_Dependent_Items
   204  End_procedure
   205
   206  // these two functions are called by radio objects when an entering or exting
   207  // event for the entire radio group. These trigger exiting and entering messages
   208  //
   209  { MethodType=Event }
   210  Function OnRadioGroupEntering returns integer
   211  end_function
   212
   213  { MethodType=Event }
   214  Function OnRadioGroupExiting returns integer
   215  end_function
   216
   217
   218End_Class
   219