1 // Copyright 2010-2018, Google Inc. 2 // All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are 6 // met: 7 // 8 // * Redistributions of source code must retain the above copyright 9 // notice, this list of conditions and the following disclaimer. 10 // * Redistributions in binary form must reproduce the above 11 // copyright notice, this list of conditions and the following disclaimer 12 // in the documentation and/or other materials provided with the 13 // distribution. 14 // * Neither the name of Google Inc. nor the names of its 15 // contributors may be used to endorse or promote products derived from 16 // this software without specific prior written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30 #ifndef MOZC_RENDERER_MAC_CANDIDATE_CONTROLLER_H_ 31 #define MOZC_RENDERER_MAC_CANDIDATE_CONTROLLER_H_ 32 33 #include "base/port.h" 34 #include "protocol/renderer_command.pb.h" 35 #include "renderer/renderer_interface.h" 36 37 namespace mozc { 38 namespace client { 39 class SendCommandInterface; 40 } // namespace client 41 42 namespace renderer { 43 namespace mac { 44 class CandidateWindow; 45 class InfolistWindow; 46 47 // CandidateController implements the renderer interface for Mac. For 48 // the detailed information of renderer interface, see 49 // renderer/renderer_interface.h. 50 class CandidateController : public RendererInterface { 51 public: 52 CandidateController(); 53 ~CandidateController(); 54 virtual bool Activate(); 55 virtual bool IsAvailable() const; 56 virtual bool ExecCommand(const commands::RendererCommand &command); 57 virtual void SetSendCommandInterface( 58 client::SendCommandInterface *send_command_interface); 59 60 private: 61 // Relocate windows to prevent overlaps. 62 void AlignWindows(); 63 64 // We don't use std::unique_ptr<> for those two pointers because we don't 65 // want to include CandidateWindow.h when the user of this class 66 // includes this file. Because CandidateWindow.h and InfolistWindow.h are in 67 // Objective-C++, the user file must be .mm files if we use 68 // std::unique_ptr<>. 69 CandidateWindow *candidate_window_; 70 CandidateWindow *cascading_window_; 71 InfolistWindow *infolist_window_; 72 mozc::commands::RendererCommand command_; 73 74 DISALLOW_COPY_AND_ASSIGN(CandidateController); 75 }; 76 77 } // namespace mac 78 } // namespace renderer 79 } // namespace mozc 80 81 #endif // MOZC_RENDERER_MAC_CANDIDATE_CONTROLLER_H_ 82