1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef DBAUI_QUERYSIZETABWINUNDOACT_HXX 24 #define DBAUI_QUERYSIZETABWINUNDOACT_HXX 25 26 #ifndef DBAUI_QUERYDESIGNUNDOACTION_HXX 27 #include "QueryDesignUndoAction.hxx" 28 #endif 29 #ifndef _DBU_QRY_HRC_ 30 #include "dbu_qry.hrc" 31 #endif 32 33 namespace dbaui 34 { 35 36 // ================================================================================================ 37 // OQuerySizeTabWinUndoAct - Undo-Klasse fuer Groessenveraenderung eines TabWins 38 class OTableWindow; 39 class OJoinSizeTabWinUndoAct : public OQueryDesignUndoAction 40 { 41 Point m_ptNextPosition; 42 Size m_szNextSize; 43 OTableWindow* m_pTabWin; 44 45 protected: 46 inline void ToggleSizePosition(); 47 48 public: 49 OJoinSizeTabWinUndoAct(OJoinTableView* pOwner, const Point& ptOriginalPos, const Size& szOriginalSize, OTableWindow* pTabWin); 50 // Nebenbedingung : es darf nicht gescrollt worden sein, waehrend die neue Groesse/Position ermittelt wurde, das heisst, die Position 51 // hier sind physische, nicht logische Koordinaten 52 // (im Gegensatz zur QueryMoveTabWinUndoAct) 53 Undo()54 virtual void Undo() { ToggleSizePosition(); } Redo()55 virtual void Redo() { ToggleSizePosition(); } 56 }; 57 58 //------------------------------------------------------------------------------ OJoinSizeTabWinUndoAct(OJoinTableView * pOwner,const Point & ptOriginalPos,const Size & szOriginalSize,OTableWindow * pTabWin)59 inline OJoinSizeTabWinUndoAct::OJoinSizeTabWinUndoAct(OJoinTableView* pOwner, const Point& ptOriginalPos, const Size& szOriginalSize, OTableWindow* pTabWin) 60 :OQueryDesignUndoAction(pOwner, STR_QUERY_UNDO_SIZETABWIN) 61 ,m_ptNextPosition(ptOriginalPos) 62 ,m_szNextSize(szOriginalSize) 63 ,m_pTabWin(pTabWin) 64 { 65 } 66 67 //------------------------------------------------------------------------------ ToggleSizePosition()68 inline void OJoinSizeTabWinUndoAct::ToggleSizePosition() 69 { 70 Point ptNext = m_pTabWin->GetPosPixel(); 71 Size szNext = m_pTabWin->GetSizePixel(); 72 73 m_pOwner->Invalidate(INVALIDATE_NOCHILDREN); 74 m_pTabWin->SetPosSizePixel(m_ptNextPosition, m_szNextSize); 75 m_pOwner->Invalidate(INVALIDATE_NOCHILDREN); 76 77 m_ptNextPosition = ptNext; 78 m_szNextSize = szNext; 79 } 80 } 81 82 #endif //DBAUI_QUERYSIZETABWINUNDOACT_HXX 83 84 85