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 _VCL_SALSESSION_HXX 25cdf0e10cSrcweir #define _VCL_SALSESSION_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "vcl/dllapi.h" 28cdf0e10cSrcweir 29cdf0e10cSrcweir enum SalSessionEventType 30cdf0e10cSrcweir { 31cdf0e10cSrcweir Interaction, 32cdf0e10cSrcweir SaveRequest, 33cdf0e10cSrcweir ShutdownCancel, 34cdf0e10cSrcweir Quit 35cdf0e10cSrcweir }; 36cdf0e10cSrcweir 37cdf0e10cSrcweir struct SalSessionEvent 38cdf0e10cSrcweir { 39cdf0e10cSrcweir SalSessionEventType m_eType; 40cdf0e10cSrcweir SalSessionEventSalSessionEvent41cdf0e10cSrcweir SalSessionEvent( SalSessionEventType eType ) 42cdf0e10cSrcweir : m_eType( eType ) 43cdf0e10cSrcweir {} 44cdf0e10cSrcweir }; 45cdf0e10cSrcweir 46cdf0e10cSrcweir struct SalSessionInteractionEvent : public SalSessionEvent 47cdf0e10cSrcweir { 48cdf0e10cSrcweir bool m_bInteractionGranted; 49cdf0e10cSrcweir SalSessionInteractionEventSalSessionInteractionEvent50cdf0e10cSrcweir SalSessionInteractionEvent( bool bGranted ) 51cdf0e10cSrcweir : SalSessionEvent( Interaction ), 52cdf0e10cSrcweir m_bInteractionGranted( bGranted ) 53cdf0e10cSrcweir {} 54cdf0e10cSrcweir }; 55cdf0e10cSrcweir 56cdf0e10cSrcweir struct SalSessionSaveRequestEvent : public SalSessionEvent 57cdf0e10cSrcweir { 58cdf0e10cSrcweir bool m_bShutdown; 59cdf0e10cSrcweir bool m_bCancelable; 60cdf0e10cSrcweir SalSessionSaveRequestEventSalSessionSaveRequestEvent61cdf0e10cSrcweir SalSessionSaveRequestEvent( bool bShutdown, bool bCancelable ) 62cdf0e10cSrcweir : SalSessionEvent( SaveRequest ), 63cdf0e10cSrcweir m_bShutdown( bShutdown ), 64cdf0e10cSrcweir m_bCancelable( bCancelable ) 65cdf0e10cSrcweir {} 66cdf0e10cSrcweir }; 67cdf0e10cSrcweir 68cdf0e10cSrcweir struct SalSessionShutdownCancelEvent : public SalSessionEvent 69cdf0e10cSrcweir { SalSessionShutdownCancelEventSalSessionShutdownCancelEvent70cdf0e10cSrcweir SalSessionShutdownCancelEvent() 71cdf0e10cSrcweir : SalSessionEvent( ShutdownCancel ) 72cdf0e10cSrcweir {} 73cdf0e10cSrcweir }; 74cdf0e10cSrcweir 75cdf0e10cSrcweir struct SalSessionQuitEvent : public SalSessionEvent 76cdf0e10cSrcweir { SalSessionQuitEventSalSessionQuitEvent77cdf0e10cSrcweir SalSessionQuitEvent() 78cdf0e10cSrcweir : SalSessionEvent( Quit ) 79cdf0e10cSrcweir {} 80cdf0e10cSrcweir }; 81cdf0e10cSrcweir 82cdf0e10cSrcweir typedef void(*SessionProc)( SalSessionEvent *pEvent); 83cdf0e10cSrcweir 84cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC SalSession 85cdf0e10cSrcweir { 86cdf0e10cSrcweir SessionProc m_aProc; 87cdf0e10cSrcweir public: SalSession()88cdf0e10cSrcweir SalSession() 89cdf0e10cSrcweir : m_aProc( 0 ) 90cdf0e10cSrcweir {} 91cdf0e10cSrcweir virtual ~SalSession(); 92cdf0e10cSrcweir SetCallback(SessionProc aCallback)93cdf0e10cSrcweir void SetCallback( SessionProc aCallback ) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir m_aProc = aCallback; 96cdf0e10cSrcweir } CallCallback(SalSessionEvent * pEvent)97cdf0e10cSrcweir void CallCallback( SalSessionEvent* pEvent ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir if( m_aProc ) 100cdf0e10cSrcweir m_aProc( pEvent ); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir // query the session manager for a user interaction slot 104cdf0e10cSrcweir virtual void queryInteraction() = 0; 105cdf0e10cSrcweir // signal the session manager that we're done with user interaction 106cdf0e10cSrcweir virtual void interactionDone() = 0; 107cdf0e10cSrcweir // signal that we're done saving 108cdf0e10cSrcweir virtual void saveDone() = 0; 109cdf0e10cSrcweir // try to cancel the sutdown in progress 110cdf0e10cSrcweir virtual bool cancelShutdown() = 0; 111cdf0e10cSrcweir }; 112cdf0e10cSrcweir 113cdf0e10cSrcweir #endif 114