• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

  • sources
  • kde-4.12
  • kdeedu
  • kig
  • modes
  • popup
objecttypeactionsprovider.cc
Go to the documentation of this file.
1 
20 #include "objecttypeactionsprovider.h"
21 
22 #include "popup.h"
23 
24 #include "../../kig/kig_part.h"
25 #include "../../kig/kig_view.h"
26 #include "../../modes/normal.h"
27 #include "../../objects/object_holder.h"
28 #include "../../objects/object_type.h"
29 
30 void ObjectTypeActionsProvider::fillUpMenu(
31  NormalModePopupObjects& popup, int menu, int& nextfree )
32 {
33  if ( popup.objects().size() != 1 ) return;
34  if ( menu != NormalModePopupObjects::ToplevelMenu ) return;
35  ObjectHolder* to = popup.objects()[0];
36  ObjectTypeCalcer* c = dynamic_cast<ObjectTypeCalcer*>( to->calcer() );
37  if ( ! c ) return;
38  const ObjectType* t = c->type();
39 
40  QStringList l = t->specialActions();
41  mnoa = l.count();
42  for ( int i = 0; i < mnoa; ++i )
43  popup.addInternalAction( menu, l.at( i ), nextfree++ );
44 }
45 
46 bool ObjectTypeActionsProvider::executeAction(
47  int menu, int& id, const std::vector<ObjectHolder*>& os,
48  NormalModePopupObjects&,
49  KigPart& doc, KigWidget& w, NormalMode& m )
50 {
51  if ( menu != NormalModePopupObjects::ToplevelMenu ) return false;
52  if ( id >= mnoa )
53  {
54  id -= mnoa;
55  return false;
56  }
57  assert( os.size() == 1 );
58  ObjectTypeCalcer* oc = dynamic_cast<ObjectTypeCalcer*>( os[0]->calcer() );
59  assert( oc );
60 
61  oc->type()->executeAction( id, *os[0], *oc, doc, w, m );
62  return true;
63 }
64 
popup.h
ObjectType::specialActions
virtual QStringList specialActions() const
return i18n'd names for the special actions.
Definition: object_type.cc:91
NormalModePopupObjects::addInternalAction
QAction * addInternalAction(int menu, const QString &name, int id)
Definition: popup.cc:276
NormalModePopupObjects::ToplevelMenu
Definition: popup.h:60
ObjectTypeCalcer
This is an ObjectCalcer that uses one of the various ObjectType's to calculate its ObjectImp...
Definition: object_calcer.h:183
NormalModePopupObjects
This is the popup menu that appears when you click on selected objects in NormalMode.
Definition: popup.h:46
ObjectHolder
An ObjectHolder represents an object as it is known to the document.
Definition: object_holder.h:40
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
NormalModePopupObjects::objects
std::vector< ObjectHolder * > objects() const
Definition: popup.h:69
ObjectType
The ObjectType class is a thing that represents the "behaviour" for a certain type.
Definition: object_type.h:32
ObjectHolder::calcer
const ObjectCalcer * calcer() const
Definition: object_holder.cc:53
ObjectTypeCalcer::type
const ObjectType * type() const
Definition: object_calcer.cc:132
objecttypeactionsprovider.h
ObjectTypeActionsProvider::fillUpMenu
void fillUpMenu(NormalModePopupObjects &popup, int menu, int &nextfree)
This file is part of Kig, a KDE program for Interactive Geometry...
Definition: objecttypeactionsprovider.cc:30
KigPart
This is a "Part".
Definition: kig_part.h:68
ObjectTypeActionsProvider::executeAction
bool executeAction(int menu, int &id, const std::vector< ObjectHolder * > &os, NormalModePopupObjects &popup, KigPart &doc, KigWidget &w, NormalMode &m)
try to execute the id'th action you added to menu menu in popup popup ( first is 0 )...
Definition: objecttypeactionsprovider.cc:46
NormalMode
Definition: normal.h:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal