Module Dfaclnt.pkg

     1// DfAClnt.pkg - DF Application Client area
     2//
     3//  Creates an MDI client area. All views and mdi_dialogs
     4//  will reside in this area
     5//
     6// This expects its parent to understand: (DfPanel.pkg provides this)
     7//    Get Client_Id
     8//
     9// 07/23/96 JJT - New Class names
    10
    11Use Windows.pkg
    12Use Set.pkg
    13
    14{ ComponentType=WinAppClass }  //JVH
    15{ ClassType=Abstract }
    16{ HelpTopic=AppClientArea }
    17{ DesignerClass=cDTClientArea }
    18Class AppClientArea is a MdiClientArea
    19
    20    Procedure Construct_Object
    21        Forward Send Construct_Object
    22
    23        { Visibility=Private }
    24        Property Integer Auto_Arrange_Icons_State TRUE
    25
    26        { Visibility=Private }
    27        Property Integer Private.Client_Scrollbar_State   TRUE
    28
    29        Delegate Set Client_Id to self
    30        // keep track of all child dialog objects (views)
    31
    32        Object Mdi_Dialogs is a Set
    33        End_object
    34
    35        { Visibility=Private }
    36        Property Integer Private.Last_Dialog_Item -1
    37    End_Procedure
    38
    39    { MethodType=Property Visibility=Private }
    40    Procedure Set Client_Scrollbar_State integer bState
    41        Set Scroll_bar_Visible_State to bState
    42        Set Private.Client_Scrollbar_State to bState
    43    End_Procedure // Set Client_Scrollbar_state
    44
    45    { MethodType=Property Visibility=Private }
    46    Function Client_Scrollbar_State returns integer
    47       function_return (Private.Client_Scrollbar_State(Self))
    48    End_Function // Client_Scrollbar_State
    49
    50    { Visibility=Private }
    51    Procedure Add_Mdi_Dialog integer Id#
    52       Send Add_element to (mdi_dialogs(Self)) Id#
    53    End_Procedure
    54
    55    { Visibility=Private }
    56    Procedure Remove_Mdi_Dialog Integer Id#
    57       integer obj#
    58       Move (mdi_dialogs(self)) to Obj#
    59       if Obj# Send Remove_element to (mdi_dialogs(Obj#)) Id#
    60    End_Procedure
    61
    62    Function Next_Mdi_Dialog Integer FindFirst returns Integer
    63       integer Id# Item# Obj#
    64       Get Private.Last_dialog_item to Item#
    65       If FindFirst Move -1 to Item#
    66       Increment Item#
    67       Set Private.Last_dialog_item to Item#
    68       Move (Mdi_dialogs(Self)) to Obj#
    69       If (Item_count(Obj#)>Item#) ;
    70          Get Value of Obj# item Item# to Id#
    71       Function_Return Id#
    72    End_Function
    73
    74    { MethodType=Property Visibility=Private }
    75    Procedure Set GuiSize Integer cy Integer cx
    76        Forward SET GuiSize to cy cx
    77        If (active_state(Self) AND Auto_Arrange_Icons_State(Self)) ;
    78            send Arrange_icons
    79    End_Procedure
    80
    81    { Visibility=Private }
    82    Procedure Private.Adjust_MDI_Margins Integer cy Integer cx Integer BorderFlag
    83        Integer cMargin
    84        If BorderFlag eq amTOP Begin
    85            Get mdi_top_margin To cMargin
    86            Set mdi_top_margin To (cMargin + cy)
    87        End
    88        Else If BorderFlag eq amBOTTOM Begin
    89            Get mdi_bottom_margin To cMargin
    90            Set mdi_bottom_margin To (cMargin + cy)
    91        End
    92        Else If BorderFlag eq amLEFT Begin
    93            Get mdi_left_margin To cMargin
    94            Set mdi_left_margin To (cMargin + cx)
    95        End
    96        Else If BorderFlag eq amRIGHT Begin
    97            Get mdi_right_margin To cMargin
    98            Set mdi_right_margin To (cMargin + cx)
    99        End
   100    End_Procedure
   101
   102    { Visibility=Private }
   103    Procedure Add_Border_Object Integer hoBorder Integer BorderFlag
   104        Integer cy cx
   105        Move (hi(GuiSize(hoBorder)))  to cy
   106        Move (low(GuiSize(hoBorder))) to cx
   107
   108        Send Private.Adjust_MDI_Margins cy cx BorderFlag
   109    End_Procedure
   110
   111    { Visibility=Private }
   112    Procedure Remove_Border_Object Integer hoBorder Integer BorderFlag
   113        Integer cy cx
   114        Move (-(hi(GuiSize(hoBorder))))  to cy
   115        Move (-(low(GuiSize(hoBorder)))) to cx
   116
   117        Send Private.Adjust_MDI_Margins cy cx BorderFlag
   118    End_Procedure
   119
   120    //
   121    // default behavior of mdi client is to passively pass these
   122    // message on to their mdi dialogs (views)
   123    //
   124    { MethodType=event Visibility=Private }
   125    Function Verify_Exit_Application Returns Integer
   126       Integer rVal Id#
   127       Get Next_Mdi_Dialog TRUE to Id#
   128       While (Id# AND Rval=0)
   129          Get Verify_Exit_application of Id# to rVal
   130          If not rval Get Next_Mdi_Dialog FALSE to Id#
   131       End
   132       function_return rval
   133    End_Function
   134
   135    { MethodType=Event Visibility=Private }
   136    Procedure Notify_Exit_Application
   137       Integer Id#
   138       Get Next_Mdi_Dialog TRUE to Id#
   139       While Id#
   140          Send Notify_Exit_Application to Id#
   141          Get Next_Mdi_Dialog FALSE to Id#
   142       End
   143    End_Procedure // Notify_Exit_Application
   144
   145    { Visibility=Private }
   146    Procedure Make_all_ViewMode integer Mode
   147       Integer Id#
   148       Get Next_Mdi_Dialog TRUE to Id#
   149       While Id#
   150          If (active_State(Id#)) ; // !!!!FIX!!!! AND View_mode(Id#)<>Mode) ;
   151             Set View_Mode of Id# to Mode
   152          Get Next_Mdi_Dialog FALSE to Id#
   153       End
   154    End_procedure
   155
   156    { Visibility=Private }
   157    Procedure Minimize_all_Windows
   158       Send Make_All_ViewMode VIEWMODE_ICONIZE
   159    End_Procedure
   160
   161    { Visibility=Private }
   162    Procedure Restore_all_Windows
   163       Send Make_All_ViewMode VIEWMODE_NORMAL
   164    End_Procedure
   165
   166    // The framework has used activate_about for years to activate an about
   167    // dialog. As of 12.1, we have a sub-class for this and providing the
   168    // required message makes things work better. It is expected that a 
   169    // developer will augment this in their clientarea to call the about
   170    // object that they created. 
   171    Procedure Activate_About
   172    End_Procedure
   173
   174
   175End_Class
   176
   177