home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Tools & Goodies / IntlTest / Sources / Select.cpp < prev    next >
Encoding:
Text File  |  1996-09-12  |  4.3 KB  |  144 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Select.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "IntlTest.hpp"
  11.  
  12. #ifndef SELECT_H
  13. #include "Select.h"
  14. #endif
  15.  
  16. #ifndef CONTENT_H
  17. #include "Content.h"
  18. #endif
  19.  
  20. #ifndef PART_H
  21. #include "Part.h"
  22. #endif
  23.  
  24. #ifndef DEFINES_K
  25. #include "Defines.k"
  26. #endif
  27.  
  28. // ----- Framework Includes -----
  29.  
  30. #ifndef FWPRESEN_H
  31. #include "FWPresen.h"
  32. #endif
  33.  
  34. // ----- Foundation Layer -----
  35.  
  36. #ifndef FWSTRING_H
  37. #include "FWString.h"
  38. #endif
  39.  
  40. // ----- OpenDoc Includes -----
  41.  
  42. #ifndef SOM_Module_OpenDoc_StdProps_defined
  43. #include <StdProps.xh>
  44. #endif
  45.  
  46. //========================================================================================
  47. //    Runtime information
  48. //========================================================================================
  49.  
  50. #ifdef FW_BUILD_MAC
  51. #pragma segment odfIntlTest
  52. #endif
  53.  
  54. //========================================================================================
  55. //    Constants
  56. //========================================================================================
  57.  
  58. const ODPropertyName kIntlTestPropText = "IntlTest:Property:Text";
  59.  
  60. //========================================================================================
  61. //    CLASS CIntlTestSelection
  62. //========================================================================================
  63.  
  64. FW_DEFINE_AUTO(CIntlTestSelection)
  65.  
  66. //---------------------------------------------------------------------------------------
  67. //    CIntlTestSelection constructor
  68. //---------------------------------------------------------------------------------------
  69.  
  70. CIntlTestSelection::CIntlTestSelection(Environment* ev, CIntlTestPart* testPart) :
  71.     FW_CSelection(ev, false, false),
  72.     fTestPart(testPart),
  73.     fSelectedContent(NULL)
  74. {
  75.     fSelectedContent = FW_NEW(CIntlTestSelectedContent, (ev, testPart));
  76. }
  77.  
  78. //---------------------------------------------------------------------------------------
  79. //    CIntlTestSelection destructor
  80. //---------------------------------------------------------------------------------------
  81.  
  82. CIntlTestSelection::~CIntlTestSelection()
  83. {
  84. }
  85.  
  86. //---------------------------------------------------------------------------------------
  87. //    CIntlTestSelection::GetSelectedContent
  88. //---------------------------------------------------------------------------------------
  89. //    The whole content is always selected
  90.  
  91. FW_CContent* CIntlTestSelection::GetSelectedContent(Environment*)
  92. {
  93.     return fSelectedContent;
  94. }
  95.  
  96. //---------------------------------------------------------------------------------------
  97. //    CIntlTestSelection::ClearSelection
  98. //---------------------------------------------------------------------------------------
  99.  
  100. void CIntlTestSelection::ClearSelection(Environment* ev)
  101. {
  102.     fSelectedContent->ClearSelectedText(ev); 
  103. }
  104.  
  105. //---------------------------------------------------------------------------------------
  106. //    CIntlTestSelection::CloseSelection
  107. //---------------------------------------------------------------------------------------
  108.  
  109. void CIntlTestSelection::CloseSelection(Environment* ev)
  110. {
  111.     // Unselect text in the current EditView
  112.     fSelectedContent->SetSelectionRange(ev, 0, 0);
  113. }
  114.  
  115. //---------------------------------------------------------------------------------------
  116. //    CIntlTestSelection::IsEmpty
  117. //---------------------------------------------------------------------------------------
  118.  
  119. FW_Boolean CIntlTestSelection::IsEmpty(Environment* ev) const
  120. {
  121.     // Is the current string empty?
  122.     FW_CString selection;
  123.     fSelectedContent->GetSelectedText(ev, selection);
  124.     return (selection.GetByteLength() == 0);
  125. }
  126.  
  127. //---------------------------------------------------------------------------------------
  128. //    CIntlTestSelection::SelectAll
  129. //---------------------------------------------------------------------------------------
  130.  
  131. void CIntlTestSelection::SelectAll(Environment*)
  132. {
  133.     // This function is handled by the current EditView
  134. }
  135.  
  136. //---------------------------------------------------------------------------------------
  137. //    CIntlTestSelection::SetContentEditView
  138. //---------------------------------------------------------------------------------------
  139. void CIntlTestSelection::SetContentEditView(FW_CEditView* editView)
  140. {
  141.     fSelectedContent->SetEditView(editView);
  142. }
  143.  
  144.