KDevelop API Documentation

view.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001 Harald Fernengel <harry@kdevelop.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #include "document.h"
00020 #include "view.h"
00021 #include "kneditfactory.h"
00022 
00023 #include <qlayout.h>
00024 #include <qlabel.h>
00025 
00026 #include <qxembed.h>
00027 #include <kdebug.h>
00028 
00029 
00030 namespace KNEdit
00031 {
00032 
00033 View::View ( Document *doc, QWidget *parent, const char *name ) : KTextEditor::View (doc, parent, name)
00034 {
00035   setInstance( KNEditFactory::instance() );
00036   
00037   doc->addView( this );
00038   m_doc = doc;
00039   setFocusPolicy( StrongFocus );
00040 
00041   QVBoxLayout *vbl = new QVBoxLayout( this );
00042 
00043   m_embed = new QXEmbed( this, "embedded NEdit" );
00044   vbl->addWidget( m_embed );
00045 }
00046 
00047 View::~View ()
00048 {
00049   if ( m_doc )
00050     m_doc->removeView( this ); 
00051 }
00052 
00053 KTextEditor::Document *View::document() const
00054 {
00055   return m_doc;
00056 }
00057 
00058 void View::embedNEdit( WId id )
00059 {
00060   kdDebug() << "View: embedding: " << id << endl;
00061 
00062   m_embed->embed( id );
00063 }
00064 
00065 
00066 QPoint View::cursorCoordinates ()
00067 {
00069   return QPoint();
00070 }
00071 
00072 void View::cursorPosition (uint *line, uint *col)
00073 {
00075 }
00076 
00077 void View::cursorPositionReal (uint *line, uint *col)
00078 {
00080 }
00081 
00082 bool View::setCursorPosition (uint line, uint col)
00083 {
00084   Q_ASSERT( m_doc );
00085   m_doc->invokeNC("-line " + QString::number(line + 1), true);
00086   return true;
00087 }
00088 
00089 bool View::setCursorPositionReal (uint line, uint col)
00090 {
00091   return setCursorPosition(line, col);
00092 }
00093 
00094 uint View::cursorLine ()
00095 {
00097   return 0;
00098 }
00099 
00100 uint View::cursorColumn ()
00101 {
00103   return 0;
00104 }
00105 
00106 uint View::cursorColumnReal ()
00107 {
00109   return 0;
00110 }
00111 
00112 };
00113 
00114 #include "view.moc"
00115 
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:41 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003