xref: /aoo42x/main/vcl/inc/unx/i18n_status.hxx (revision 161f4cd1)
1*161f4cd1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*161f4cd1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*161f4cd1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*161f4cd1SAndrew Rist  * distributed with this work for additional information
6*161f4cd1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*161f4cd1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*161f4cd1SAndrew Rist  * "License"); you may not use this file except in compliance
9*161f4cd1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*161f4cd1SAndrew Rist  *
11*161f4cd1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*161f4cd1SAndrew Rist  *
13*161f4cd1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*161f4cd1SAndrew Rist  * software distributed under the License is distributed on an
15*161f4cd1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*161f4cd1SAndrew Rist  * KIND, either express or implied.  See the License for the
17*161f4cd1SAndrew Rist  * specific language governing permissions and limitations
18*161f4cd1SAndrew Rist  * under the License.
19*161f4cd1SAndrew Rist  *
20*161f4cd1SAndrew Rist  *************************************************************/
21*161f4cd1SAndrew Rist 
22*161f4cd1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SAL_I18N_STATUS_HXX
25cdf0e10cSrcweir #define _SAL_I18N_STATUS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/string.hxx>
28cdf0e10cSrcweir #include <tools/link.hxx>
29cdf0e10cSrcweir #include <tools/gen.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <rtl/ustring.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <salimestatus.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <vector>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class SalFrame;
38cdf0e10cSrcweir class WorkWindow;
39cdf0e10cSrcweir class ListBox;
40cdf0e10cSrcweir class FixedText;
41cdf0e10cSrcweir class PushButton;
42cdf0e10cSrcweir class SalI18N_InputContext;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace vcl
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class StatusWindow;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class X11ImeStatus : public SalI18NImeStatus
50cdf0e10cSrcweir {
51cdf0e10cSrcweir public:
X11ImeStatus()52cdf0e10cSrcweir     X11ImeStatus() {}
53cdf0e10cSrcweir     virtual ~X11ImeStatus();
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     virtual bool canToggle();
56cdf0e10cSrcweir     virtual void toggle();
57cdf0e10cSrcweir };
58cdf0e10cSrcweir 
59cdf0e10cSrcweir class I18NStatus
60cdf0e10cSrcweir {
61cdf0e10cSrcweir public:
62cdf0e10cSrcweir     struct ChoiceData
63cdf0e10cSrcweir     {
64cdf0e10cSrcweir         String	aString;
65cdf0e10cSrcweir         void*	pData;
66cdf0e10cSrcweir     };
67cdf0e10cSrcweir private:
68cdf0e10cSrcweir     SalFrame*				        m_pParent;
69cdf0e10cSrcweir     StatusWindow*			        m_pStatusWindow;
70cdf0e10cSrcweir     String					        m_aCurrentIM;
71cdf0e10cSrcweir     ::std::vector< ChoiceData >     m_aChoices;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     I18NStatus();
74cdf0e10cSrcweir     ~I18NStatus();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     static I18NStatus* pInstance;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     static bool getStatusWindowMode();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir public:
81cdf0e10cSrcweir     static I18NStatus& get();
82cdf0e10cSrcweir     static bool exists();
83cdf0e10cSrcweir     static void free();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     void setParent( SalFrame* pParent );
getParent() const86cdf0e10cSrcweir     SalFrame* getParent() const { return  m_pParent; }
87cdf0e10cSrcweir     SalFrame* getStatusFrame() const;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     void setStatusText( const String& rText );
90cdf0e10cSrcweir     String getStatusText() const;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     enum ShowReason { focus, presentation, contextmap };
93cdf0e10cSrcweir     void show( bool bShow, ShowReason eReason );
94cdf0e10cSrcweir 
getChoices() const95cdf0e10cSrcweir     const ::std::vector< ChoiceData >& getChoices() const { return m_aChoices; }
96cdf0e10cSrcweir     void clearChoices();
97cdf0e10cSrcweir     void addChoice( const String&, void* pData );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     void toTop() const;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     // for SwitchIMCallback
102cdf0e10cSrcweir     void changeIM( const String& );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     // External Control:
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     /** Return true if the status window can be toggled on and off externally.
107cdf0e10cSrcweir      */
108cdf0e10cSrcweir     bool canToggleStatusWindow() const;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     /** Toggle the status window on or off.
111cdf0e10cSrcweir 
112cdf0e10cSrcweir         This only works if canToggleStatusWindow returns true (otherwise, any
113cdf0e10cSrcweir         calls of this method are ignored).
114cdf0e10cSrcweir      */
115cdf0e10cSrcweir     void toggleStatusWindow();
116cdf0e10cSrcweir };
117cdf0e10cSrcweir 
118cdf0e10cSrcweir } // namespace
119cdf0e10cSrcweir 
120cdf0e10cSrcweir #endif // _SAL_I18N_STATUS_HXX
121