IMECandidateCtrl.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __IMECANDIDATECTRL_H__
  19. #define __IMECANDIDATECTRL_H__
  20. #include "DialogControl.h"
  21. #include "ScrollBarCtrl.h"
  22. #include "Render2D.h"
  23. #include "Render2DSentence.h"
  24. #include "Vector.h"
  25. namespace IME
  26. {
  27. class IMECandidate;
  28. }
  29. class IMECandidateCtrl :
  30. public DialogControlClass
  31. {
  32. public:
  33. IMECandidateCtrl();
  34. virtual ~IMECandidateCtrl();
  35. void Init(IME::IMECandidate* candidate);
  36. void Changed(IME::IMECandidate* candidate);
  37. void Reset(void);
  38. protected:
  39. void CreateControlRenderer(void);
  40. void CreateTextRenderer(void);
  41. void SetCurrSel(int index);
  42. int EntryFromPos(const Vector2& mousePos);
  43. void UpdateScrollPos(void);
  44. void CalculateCandidatePageExtent(Vector2& outExtent, Vector2& outCellSize);
  45. // DialogControlClass methods
  46. public:
  47. const RectClass& Get_Window_Rect(void) const
  48. {return mFullRect;}
  49. protected:
  50. void Render(void);
  51. void Update_Client_Rect(void);
  52. void On_Set_Cursor(const Vector2& mousePos);
  53. void On_LButton_Down(const Vector2& mousePos);
  54. void On_LButton_Up(const Vector2& mousePos);
  55. void On_Add_To_Dialog(void);
  56. void On_Remove_From_Dialog(void);
  57. // ControlAdviseSinkClass methods
  58. protected:
  59. void On_VScroll(ScrollBarCtrlClass*, int, int);
  60. // Data members
  61. protected:
  62. RectClass mFullRect;
  63. Vector2 mCellSize;
  64. int mCurrSel;
  65. unsigned int mScrollPos;
  66. unsigned int mCellsPerPage;
  67. ScrollBarCtrlClass mScrollBarCtrl;
  68. RectClass mScrollBarRect;
  69. Render2DClass mControlRenderer;
  70. Render2DClass mHilightRenderer;
  71. Render2DSentenceClass mTextRenderer;
  72. IME::IMECandidate* mCandidate;
  73. };
  74. #endif // __IMECANDIDATECTRL_H__