File indexing completed on 2024-04-28 15:23:21

0001 /* This file is part of the KDE project
0002  *
0003  * Copyright (C) 2004 Leo Savernik <l.savernik@aon.at>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0018  * Boston, MA 02111-1307, USA.
0019  */
0020 
0021 #ifndef EDITING_P_H
0022 #define EDITING_P_H
0023 
0024 #include "xml/dom_selection.h"
0025 
0026 #include <limits.h>
0027 
0028 namespace DOM
0029 {
0030 class Editor;
0031 }
0032 
0033 namespace khtml
0034 {
0035 
0036 /**
0037  * Contextual information about the caret and the built-in editor
0038  * @author Leo Savernik
0039  */
0040 struct EditorContext {
0041 
0042     enum { NoXPosForVerticalArrowNavigation = INT_MIN };
0043 
0044     DOM::Selection::ETextGranularity m_selectionGranularity;
0045 
0046     DOM::Selection m_selection;
0047     DOM::Selection m_dragCaret;
0048     int m_caretBlinkTimer;
0049 
0050     bool m_caretVisible: 1;
0051     bool m_caretBlinks: 1;
0052     bool m_caretPaint: 1;
0053 
0054     bool m_beganSelectingText: 1;
0055 
0056     void beginSelectingText(DOM::Selection::ETextGranularity granularity)
0057     {
0058         m_beganSelectingText   = true;
0059         m_selectionGranularity = granularity;
0060     }
0061 
0062     int m_xPosForVerticalArrowNavigation;
0063     DOM::Editor *m_editor;
0064 
0065     EditorContext()
0066         : m_caretBlinkTimer(-1),
0067           m_caretVisible(true),
0068           m_caretBlinks(true),
0069           m_caretPaint(true),
0070           m_beganSelectingText(false),
0071           m_editor(nullptr)
0072     {
0073     }
0074 
0075     ~EditorContext();
0076 
0077     void reset();
0078 
0079 };
0080 
0081 }/*namespace khtml*/
0082 
0083 #endif