home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kstdaccel.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  13.8 KB  |  493 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 1997 Stefan Taferner (taferner@kde.org)
  3.     Copyright (C) 2000 Nicolas Hadacek (hadacek@kde.org)
  4.     Copyright (C) 2001,2002 Ellis Whitehead (ellis@kde.org)
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License version 2 as published by the Free Software Foundation.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef KSTDACCEL_H
  21. #define KSTDACCEL_H
  22.  
  23. #include <qstring.h>
  24. #include <kshortcut.h>
  25. #include "kdelibs_export.h"
  26.  
  27. class QKeyEvent;
  28. class KAccelActions;
  29.  
  30. /**
  31.  * \namespace KStdAccel
  32.  * Convenient methods for access to the common accelerator keys in
  33.  * the key configuration. These are the standard keybindings that should
  34.  * be used in all KDE applications. They will be configurable,
  35.  * so do not hardcode the default behavior.
  36.  *
  37.  * If you want real configurable keybindings in your applications,
  38.  * please checkout the class KAccel in kaccel.h
  39.  * @see KAccelShortcutList
  40.  */
  41. namespace KStdAccel
  42. {
  43.   // Always add new std-accels to the end of this enum, never in the middle!
  44.   /**
  45.    * Defines the identifier of all standard accelerators.
  46.    */
  47.   enum StdAccel {
  48.     AccelNone,
  49.     // File menu
  50.     Open, New, Close, Save,
  51.     // The Print item
  52.     Print,
  53.     Quit,
  54.     // Edit menu
  55.     Undo, Redo, Cut, Copy, Paste, SelectAll, Deselect, DeleteWordBack,
  56.     DeleteWordForward, Find, FindNext, FindPrev, Replace,
  57.     // Navigation
  58.     Home, End, Prior, Next, GotoLine, AddBookmark, ZoomIn, ZoomOut,
  59.     Up, Back, Forward, Reload, PopupMenuContext, ShowMenubar,
  60.     // Help menu
  61.     Help, WhatsThis,
  62.     // Text completion
  63.     TextCompletion, PrevCompletion, NextCompletion, SubstringCompletion,
  64.     RotateUp, RotateDown,
  65.  
  66.     // Tabular navigation
  67.     TabNext,           ///< @since 3.2
  68.     TabPrev,           ///< @since 3.2
  69.  
  70.     // Full screen mode
  71.     FullScreen,        ///< @since 3.2
  72.  
  73.     // Text Navigation
  74.     BackwardWord,      ///< @since 3.3
  75.     ForwardWord,       ///< @since 3.3
  76.     BeginningOfLine,   ///< @since 3.3
  77.     EndOfLine,         ///< @since 3.3
  78.  
  79.     PasteSelection     ///< @since 3.4
  80.  
  81. #ifndef KDE_NO_COMPAT
  82.     , WhatThis = WhatsThis
  83. #endif
  84.   };
  85.  
  86.   /**
  87.    * Returns the keybinding for @p accel.
  88.    * @param id the id of the accelerator
  89.    */
  90.   KDECORE_EXPORT const KShortcut& shortcut(StdAccel id);
  91.  
  92.   /**
  93.    * Returns a unique name for the given accel.
  94.    * @param id the id of the accelerator
  95.    * @return the unique name of the accelerator
  96.    */
  97.   KDECORE_EXPORT QString name(StdAccel id);
  98.  
  99.   /**
  100.    * Returns a localized label for user-visible display.
  101.    * @param id the id of the accelerator
  102.    * @return a localized label for the accelerator
  103.    */
  104.   KDECORE_EXPORT QString label(StdAccel id);
  105.  
  106.   /**
  107.    * Returns an extended WhatsThis description for the given accelerator.
  108.    * @param id the id of the accelerator
  109.    * @return a localized description of the accelerator
  110.    */
  111.   KDECORE_EXPORT QString whatsThis(StdAccel id);
  112.  
  113.   /**
  114.    * Return the StdAccel id of the standard accel action which
  115.    * uses this key sequence, or AccelNone if none of them do.
  116.    * This is used by class KKeyChooser.
  117.    * @param keySeq the key sequence to search
  118.    * @return the id of the standard accelerator, or AccelNone if there
  119.    *          is none
  120.    */
  121.   KDECORE_EXPORT StdAccel findStdAccel( const KKeySequence &keySeq );
  122.  
  123.   /**
  124.    * Returns the hardcoded default shortcut for @p id.
  125.    * This does not take into account the user's configuration.
  126.    * @param id the id of the accelerator
  127.    * @return the default shortcut of the accelerator
  128.    */
  129.   KDECORE_EXPORT KShortcut shortcutDefault(StdAccel id);
  130.   /**
  131.    * Returns the hardcoded default 3 modifier shortcut for @p id.
  132.    * This does not take into account the user's configuration.
  133.    * @param id the id of the accelerator
  134.    * @return the default 3 modifier shortcut
  135.    */
  136.   KDECORE_EXPORT KShortcut shortcutDefault3(StdAccel id);
  137.   /**
  138.    * Returns the hardcoded default 4 modifier shortcut for @p id.
  139.    * This does not take into account the user's configuration.
  140.    * @param id the id of the accelerator
  141.    * @return the default 4 modifier shortcut
  142.    */
  143.   KDECORE_EXPORT KShortcut shortcutDefault4(StdAccel id);
  144.  
  145.   /**
  146.    * Open file. Default: Ctrl-o
  147.    * @return the shortcut of the standard accelerator
  148.    */
  149.   KDECORE_EXPORT const KShortcut& open();
  150.  
  151.   /**
  152.    * Create a new document (or whatever). Default: Ctrl-n
  153.    * @return the shortcut of the standard accelerator
  154.    */
  155.   KDECORE_EXPORT const KShortcut& openNew();
  156.  
  157.   /**
  158.    * Close current document. Default: Ctrl-w
  159.    * @return the shortcut of the standard accelerator
  160.    */
  161.   KDECORE_EXPORT const KShortcut& close();
  162.  
  163.   /**
  164.    * Save current document. Default: Ctrl-s
  165.    * @return the shortcut of the standard accelerator
  166.    */
  167.   KDECORE_EXPORT const KShortcut& save();
  168.  
  169.   /**
  170.    * Print current document. Default: Ctrl-p
  171.    * @return the shortcut of the standard accelerator
  172.    */
  173.   KDECORE_EXPORT const KShortcut& print();
  174.  
  175.   /**
  176.    * Quit the program. Default: Ctrl-q
  177.    * @return the shortcut of the standard accelerator
  178.    */
  179.   KDECORE_EXPORT const KShortcut& quit();
  180.  
  181.   /**
  182.    * Undo last operation. Default: Ctrl-z
  183.    * @return the shortcut of the standard accelerator
  184.    */
  185.   KDECORE_EXPORT const KShortcut& undo();
  186.  
  187.   /**
  188.    * Redo. Default: Shift-Ctrl-z
  189.    * @return the shortcut of the standard accelerator
  190.    */
  191.   KDECORE_EXPORT const KShortcut& redo();
  192.  
  193.   /**
  194.    * Cut selected area and store it in the clipboard. Default: Ctrl-x
  195.    * @return the shortcut of the standard accelerator
  196.    */
  197.   KDECORE_EXPORT const KShortcut& cut();
  198.  
  199.   /**
  200.    * Copy selected area into the clipboard. Default: Ctrl-c
  201.    * @return the shortcut of the standard accelerator
  202.    */
  203.   KDECORE_EXPORT const KShortcut& copy();
  204.  
  205.   /**
  206.    * Paste contents of clipboard at mouse/cursor position. Default: Ctrl-v
  207.    * @return the shortcut of the standard accelerator
  208.    */
  209.   KDECORE_EXPORT const KShortcut& paste();
  210.  
  211.   /**
  212.    * Paste the selection at mouse/cursor position. Default: Ctrl-Shift-Insert
  213.    * @return the shortcut of the standard accelerator
  214.    * @since 3.4
  215.    */
  216.   KDECORE_EXPORT const KShortcut& pasteSelection();
  217.  
  218.   /**
  219.    * Reload. Default: Ctrl-A
  220.    * @return the shortcut of the standard accelerator
  221.    **/
  222.   KDECORE_EXPORT const KShortcut& selectAll();
  223.  
  224.   /**
  225.    * Delete a word back from mouse/cursor position. Default: Ctrl-Backspace
  226.    * @return the shortcut of the standard accelerator
  227.    */
  228.   KDECORE_EXPORT const KShortcut& deleteWordBack();
  229.  
  230.   /**
  231.    * Delete a word forward from mouse/cursor position. Default: Ctrl-Delete
  232.    * @return the shortcut of the standard accelerator
  233.    */
  234.   KDECORE_EXPORT const KShortcut& deleteWordForward();
  235.  
  236.   /**
  237.    * Find, search. Default: Ctrl-f
  238.    * @return the shortcut of the standard accelerator
  239.    */
  240.   KDECORE_EXPORT const KShortcut& find();
  241.  
  242.   /**
  243.    * Find/search next. Default: F3
  244.    * @return the shortcut of the standard accelerator
  245.    */
  246.   KDECORE_EXPORT const KShortcut& findNext();
  247.  
  248.   /**
  249.    * Find/search previous. Default: Shift-F3
  250.    * @return the shortcut of the standard accelerator
  251.    */
  252.   KDECORE_EXPORT const KShortcut& findPrev();
  253.  
  254.   /**
  255.    * Find and replace matches. Default: Ctrl-r
  256.    * @return the shortcut of the standard accelerator
  257.    */
  258.   KDECORE_EXPORT const KShortcut& replace();
  259.  
  260.   /**
  261.    * Zoom in. Default: Ctrl-Plus
  262.    * @return the shortcut of the standard accelerator
  263.    */
  264.   KDECORE_EXPORT const KShortcut& zoomIn();
  265.  
  266.   /**
  267.    * Zoom out. Default: Ctrl-Minus
  268.    * @return the shortcut of the standard accelerator
  269.    */
  270.   KDECORE_EXPORT const KShortcut& zoomOut();
  271.  
  272.   /**
  273.    * Toggle insert/overwrite (with visual feedback, e.g. in the statusbar). Default: Insert
  274.    * @return the shortcut of the standard accelerator
  275.    */
  276.   KDECORE_EXPORT const KShortcut& insert();
  277.  
  278.   /**
  279.    * Goto beginning of the document. Default: Ctrl-Home
  280.    * @return the shortcut of the standard accelerator
  281.    */
  282.   KDECORE_EXPORT const KShortcut& home();
  283.  
  284.   /**
  285.    * Goto end of the document. Default: Ctrl-End
  286.    * @return the shortcut of the standard accelerator
  287.    */
  288.   KDECORE_EXPORT const KShortcut& end();
  289.  
  290.   /**
  291.    * Goto beginning of current line. Default: Home
  292.    * @return the shortcut of the standard accelerator
  293.    * @since 3.3
  294.    */
  295.   KDECORE_EXPORT const KShortcut& beginningOfLine();
  296.  
  297.   /**
  298.    * Goto end of current line. Default: End
  299.    * @return the shortcut of the standard accelerator
  300.    * @since 3.3
  301.    */
  302.   KDECORE_EXPORT const KShortcut& endOfLine();
  303.  
  304.   /**
  305.    * Scroll up one page. Default: Prior
  306.    * @return the shortcut of the standard accelerator
  307.    */
  308.   KDECORE_EXPORT const KShortcut& prior();
  309.  
  310.   /**
  311.    * Scroll down one page. Default: Next
  312.    * @return the shortcut of the standard accelerator
  313.    */
  314.   KDECORE_EXPORT const KShortcut& next();
  315.  
  316.   /**
  317.    * Go to line. Default: Ctrl+G
  318.    * @return the shortcut of the standard accelerator
  319.    */
  320.   KDECORE_EXPORT const KShortcut& gotoLine();
  321.  
  322.   /**
  323.    * Add current page to bookmarks. Default: Ctrl+B
  324.    * @return the shortcut of the standard accelerator
  325.    */
  326.   KDECORE_EXPORT const KShortcut& addBookmark();
  327.  
  328.   /**
  329.    * Next Tab. Default: Ctrl-<
  330.    * @return the shortcut of the standard accelerator
  331.    * @since 3.2
  332.    */
  333.   KDECORE_EXPORT const KShortcut& tabNext();
  334.  
  335.   /**
  336.    * Previous Tab. Default: Ctrl->
  337.    * @return the shortcut of the standard accelerator
  338.    * @since 3.2
  339.    */
  340.   KDECORE_EXPORT const KShortcut& tabPrev();
  341.  
  342.   /**
  343.    * Full Screen Mode. Default: Ctrl+Shift+F
  344.    * @return the shortcut of the standard accelerator
  345.    * @since 3.2
  346.    */
  347.   KDECORE_EXPORT const KShortcut& fullScreen();
  348.  
  349.   /**
  350.    * Help the user in the current situation. Default: F1
  351.    * @return the shortcut of the standard accelerator
  352.    */
  353.   KDECORE_EXPORT const KShortcut& help();
  354.  
  355.   /**
  356.    * Complete text in input widgets. Default Ctrl+E
  357.    * @return the shortcut of the standard accelerator
  358.    **/
  359.   KDECORE_EXPORT const KShortcut& completion();
  360.  
  361.   /**
  362.    * Iterate through a list when completion returns
  363.    * multiple items. Default: Ctrl+Up
  364.    * @return the shortcut of the standard accelerator
  365.    */
  366.   KDECORE_EXPORT const KShortcut& prevCompletion();
  367.  
  368.   /**
  369.    * Iterate through a list when completion returns
  370.    * multiple items. Default: Ctrl+Down
  371.    * @return the shortcut of the standard accelerator
  372.    */
  373.   KDECORE_EXPORT const KShortcut& nextCompletion();
  374.  
  375.   /**
  376.    * Find a string within another string or list of strings.
  377.    * Default: Ctrl-T
  378.    * @return the shortcut of the standard accelerator
  379.    */
  380.   KDECORE_EXPORT const KShortcut& substringCompletion();
  381.  
  382.   /**
  383.    * Help users iterate through a list of entries. Default: Up
  384.    * @return the shortcut of the standard accelerator
  385.    */
  386.   KDECORE_EXPORT const KShortcut& rotateUp();
  387.  
  388.   /**
  389.    * Help users iterate through a list of entries. Default: Down
  390.    * @return the shortcut of the standard accelerator
  391.    */
  392.   KDECORE_EXPORT const KShortcut& rotateDown();
  393.  
  394.   /**
  395.    * popup a context menu. Default: Menu
  396.    * @return the shortcut of the standard accelerator
  397.    */
  398.   KDECORE_EXPORT const KShortcut& popupMenuContext();
  399.  
  400.   /**
  401.    * What's This button. Default: Shift+F1
  402.    * @return the shortcut of the standard accelerator
  403.    */
  404.   KDECORE_EXPORT const KShortcut& whatsThis();
  405.  
  406.   /**
  407.    * Reload. Default: F5
  408.    * @return the shortcut of the standard accelerator
  409.    */
  410.   KDECORE_EXPORT const KShortcut& reload();
  411.  
  412.   /**
  413.    * Up. Default: Alt+Up
  414.    * @return the shortcut of the standard accelerator
  415.    */
  416.   KDECORE_EXPORT const KShortcut& up();
  417.  
  418.   /**
  419.    * Back. Default: Alt+Left
  420.    * @return the shortcut of the standard accelerator
  421.    */
  422.   KDECORE_EXPORT const KShortcut& back();
  423.  
  424.   /**
  425.    * Forward. Default: ALT+Right
  426.    * @return the shortcut of the standard accelerator
  427.    */
  428.   KDECORE_EXPORT const KShortcut& forward();
  429.  
  430.   /**
  431.    * BackwardWord. Default: Ctrl+Left
  432.    * @return the shortcut of the standard accelerator
  433.    * @since 3.3
  434.    */
  435.   KDECORE_EXPORT const KShortcut& backwardWord();
  436.  
  437.   /**
  438.    * ForwardWord. Default: Ctrl+Right
  439.    * @return the shortcut of the standard accelerator
  440.    * @since 3.3
  441.    */
  442.   KDECORE_EXPORT const KShortcut& forwardWord();
  443.  
  444.   /**
  445.    * Show Menu Bar.  Default: Ctrl-M
  446.    * @return the shortcut of the standard accelerator
  447.    */
  448.   KDECORE_EXPORT const KShortcut& showMenubar();
  449.  
  450. #if !defined(KDE_NO_COMPAT) && !defined(__KSTDACCEL_CPP_)
  451.   /**
  452.    * @deprecated
  453.    * Obsolete.  Use name().  Returns a string representation for @p accel.
  454.    */
  455.   KDECORE_EXPORT QString action(StdAccel id) KDE_DEPRECATED;
  456.   /**
  457.    * @deprecated
  458.    * Obsolete.  Use desc().  Returns a localized description of @p accel.
  459.    */
  460.   KDECORE_EXPORT QString description(StdAccel id) KDE_DEPRECATED;
  461.   /**
  462.    * @deprecated
  463.    * Obsolete.  Use shortcut().  Returns the keybinding for @p accel.
  464.    */
  465.   KDECORE_EXPORT int key(StdAccel) KDE_DEPRECATED;
  466.   /**
  467.    * @deprecated
  468.    * Obsolete.  Use shortcutDefault().
  469.    */
  470.   KDECORE_EXPORT int defaultKey(StdAccel accel) KDE_DEPRECATED;
  471.  
  472.   /**
  473.    * @deprecated.  Use KKey(const QKeyEvent*) == KKey(int).
  474.    *
  475.    * Compare the keys generated by the key event with
  476.    * the value of the integer.
  477.    *
  478.    * If a modifier (Shift, Alt, Ctrl) key is present in
  479.    * QKeyEvent, its sum with the actual key value
  480.    * is used for comparing it with the integer parameter.
  481.    *
  482.    * @param pEvent the key event to be used in the comparison.
  483.    * @param keyQt the int value to be compared to the key event.
  484.    *
  485.    * @return true if the int value matches the integer representation of the QKeyEvent
  486.    */
  487.   KDECORE_EXPORT bool isEqual(const QKeyEvent* pEvent, int keyQt) KDE_DEPRECATED;
  488. #endif // !KDE_NO_COMPAT
  489.  
  490. }
  491.  
  492. #endif
  493.