2 Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
3 Copyright (C) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
5 Refactored from earlier code by:
6 Copyright (c) 2010 Volker Krause <vkrause@kde.org>
7 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
9 This library is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or (at your
12 option) any later version.
14 This library is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
17 License for more details.
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to the
21 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #ifndef MULTIPLYINGLINEEDITOR_P_H
26 #define MULTIPLYINGLINEEDITOR_P_H
28 #include "multiplyingline.h"
29 #include "multiplyinglineeditor.h"
31 #include <KGlobalSettings>
34 #include <QScrollArea>
38 class MultiplyingLineView
: public QScrollArea
42 MultiplyingLineView( MultiplyingLineFactory
* factory
, MultiplyingLineEditor
*parent
);
43 ~MultiplyingLineView(){}
45 QSize
minimumSizeHint() const;
46 QSize
sizeHint() const;
48 MultiplyingLine
*activeLine() const;
50 MultiplyingLine
*emptyLine() const;
52 QList
<MultiplyingLineData::Ptr
> allData() const;
54 /** Removes data provided it can be found. The Data class must support operator==
55 @param data The data you want to remove.
57 void removeData( const MultiplyingLineData::Ptr
&data
);
59 /** Returns true if the user has made any modifications to the list of
61 @return whether the view is modified or not.
63 bool isModified() const;
65 /** Resets the modified flag to false.
69 /** Activates the line */
70 void activateLine( MultiplyingLine
*line
);
73 * Set the width of the left most column to be the argument width.
74 * This method allows other widgets to align their label/combobox column with ours
75 * by communicating how many pixels that first column is for them.
76 * Returns the width that is actually being used.
78 int setFirstColumnWidth( int );
81 Make this widget follow it's children's size
82 @param resize turn on or off this behavior of auto resizing
84 void setAutoResize( bool resize
);
88 * Sets whether the size hint of the editor shall be calculated
89 * dynamically by the number of lines. Default is @c true.
91 void setDynamicSizeHint( bool dynamic
);
92 bool dynamicSizeHint() const;
94 QList
<MultiplyingLine
*> lines() const;
97 void setCompletionMode( KGlobalSettings::Completion mode
);
98 MultiplyingLine
*addLine();
102 void setFocusBottom();
108 void completionModeChanged( KGlobalSettings::Completion
);
109 void sizeHintChanged();
110 void lineDeleted( int pos
);
111 void lineAdded( KPIM::MultiplyingLine
* );
114 void resizeEvent( QResizeEvent
* );
118 void slotReturnPressed( KPIM::MultiplyingLine
* );
119 void slotDownPressed( KPIM::MultiplyingLine
* );
120 void slotUpPressed( KPIM::MultiplyingLine
* );
121 void slotDecideLineDeletion( KPIM::MultiplyingLine
* );
122 void slotDeleteLine();
123 void moveCompletionPopup();
124 void moveScrollBarToEnd();
127 QList
<MultiplyingLine
*> mLines
;
128 QPointer
<MultiplyingLine
> mCurDelLine
;
130 int mFirstColumnWidth
;
132 KGlobalSettings::Completion mCompletionMode
;
135 MultiplyingLineFactory
*mMultiplyingLineFactory
;
137 bool mDynamicSizeHint
;
141 #endif //MULTIPLYINGLINEEDITOR_P_H