|
OWLNext 6.32
|
#include <rcntfile.h>
Public Types | |
| enum | { MaxMenuItems = 10 } |
Public Member Functions | |
| TRecentFiles (const tstring &iniOrKeyName, int numSavedFiles=MaxMenuItems, int namelen=30, bool useRegistry=false) | |
| virtual | ~TRecentFiles () |
| void | SaveMenuChoice (LPCTSTR text) |
| void | SaveMenuChoice (const tstring &text) |
| void | RemoveMenuChoice (LPCTSTR text) |
| void | RemoveMenuChoice (const tstring &text) |
| bool | GetMenuText (int id, TCHAR *text, int maxTextLen) |
| tstring | GetMenuText (int id) |
| void | SetMaxMruItems (int max) |
| void | SetDispLength (const int) |
| void | EnableRegistry (bool enable=true) |
| int | GetMruCount () |
Protected Member Functions | |
| void | CeExit (TCommandEnabler &ce) |
| void | CmFile (uint id) |
| bool | MruItemsInsertedIntoMenu (HMENU hMenu) |
| void | RemoveMruItemsFromMenu (HMENU hMenu) |
| void | InsertMruItemsToMenu (HMENU hMenu) |
| int | GetMenuPos (HMENU hMenu, uint id) |
| int | GetExitMenuPos (HMENU hMenu) |
| void | RemoveMruIndex (int index) |
| void | AddMruItem (LPCTSTR text) |
| void | AddMruItem (const tstring &text) |
| bool | ExistMruItem (LPCTSTR text) |
| bool | ExistMruItem (const tstring &text) |
| int | GetMruItemIndex (LPCTSTR text) |
| int | GetMruItemIndex (const tstring &text) |
TRecentFiles implements a most-recent files list, designed to be mixed in with TApplication. The list is appended to the menu with CM_FILEOPEN and CM_FILECLOSE options.
| owl::TRecentFiles::TRecentFiles | ( | const tstring & | iniName, |
| int | numSavedFiles = MaxMenuItems, |
||
| int | namelen = 30, |
||
| bool | useRegistry = false |
||
| ) |
Constructor to initialize the external storage and the maximum number of items to save in the most-recently-used (MRU) list.
References owl::TFileName::Canonical(), MruFileMessage, and SetMaxMruItems().
| owl::TRecentFiles::~TRecentFiles | ( | ) | [virtual] |
Deletes the allocated profile.
| void owl::TRecentFiles::AddMruItem | ( | LPCTSTR | text | ) | [protected] |
Adds an item to the top of the MRU list. If there is a duplicate, the item is moved from its current position to the top of the list.
References owl::TFileName::Canonical().
| void owl::TRecentFiles::CeExit | ( | TCommandEnabler & | ce | ) | [protected] |
Reads information in the TProfile to display the menu choices.
References owl::TCommandEnabler::Enable(), owl::TMenuItemEnabler::GetMenu(), InsertMruItemsToMenu(), and RemoveMruItemsFromMenu().
| void owl::TRecentFiles::CmFile | ( | uint | id | ) | [protected] |
Responds to a menu item selection.
References owl::TApplication::GetMainWindow(), and owl::TWindow::SendMessage().
| bool owl::TRecentFiles::ExistMruItem | ( | LPCTSTR | text | ) | [protected] |
Returns true if there are any items in the MRU list that match the text.
References GetMruItemIndex().
| int owl::TRecentFiles::GetExitMenuPos | ( | HMENU | hMenu | ) | [protected] |
Retrieves the menu position of the CM_EXIT menu item. Returns -1 if not found.
References GetMenuPos().
| int owl::TRecentFiles::GetMenuPos | ( | HMENU | hMenu, |
| uint | id | ||
| ) | [protected] |
Searches the menu to find the position of a menu item.
| bool owl::TRecentFiles::GetMenuText | ( | int | id, |
| TCHAR * | text, | ||
| int | maxTextLen | ||
| ) |
Retrieves the text of the choice based on the ID.
| tstring owl::TRecentFiles::GetMenuText | ( | int | id | ) |
Retrieves the text of the choice based on the ID.
| int owl::TRecentFiles::GetMruCount | ( | ) | [inline] |
Returns the number of files that are currently in the MRU list.
| int owl::TRecentFiles::GetMruItemIndex | ( | LPCTSTR | text | ) | [protected] |
Returns the index of the MRU item containing text. Returns -1 if not found.
| void owl::TRecentFiles::InsertMruItemsToMenu | ( | HMENU | hMenu | ) | [protected] |
Reads external information and adds the MRU items into the menu. Adds a separator between the MRU items and the exit menu item.
References owl::TFileName::CurrentDir, owl::TFileName::Ext, owl::TFileName::File, GetExitMenuPos(), owl::TFileName::GetParts(), owl::TMenu::InsertMenu(), and owl::TFileName::Squeezed().
| bool owl::TRecentFiles::MruItemsInsertedIntoMenu | ( | HMENU | hMenu | ) | [protected] |
Returns true if the menu has any MRU items in it.
References GetMenuPos().
| void owl::TRecentFiles::RemoveMruIndex | ( | int | index | ) | [protected] |
Removes the MRU item at index. Shuffles the items below index up.
| void owl::TRecentFiles::RemoveMruItemsFromMenu | ( | HMENU | hMenu | ) | [protected] |
Removes the MRU items from the menu.
References GetExitMenuPos(), GetMenuPos(), and MruItemsInsertedIntoMenu().
| void owl::TRecentFiles::SaveMenuChoice | ( | LPCTSTR | text | ) |
Saves the menu choice into the profile.
References AddMruItem(), GetMruItemIndex(), and RemoveMruIndex().
| void owl::TRecentFiles::SetMaxMruItems | ( | int | max | ) |
Sets the maximum number of items that can be saved with this MRU.
1.7.4