|
OWLNext 7.0
Borland's Object Windows Library for the modern age
|
TRecentFiles implements a most-recent files list, designed to be mixed in with TApplication. More...
#include <owl/rcntfile.h>
Public Types | |
| enum | { MaxMenuItems = 10 } |
| Public Types inherited from owl::TEventHandler | |
| typedef bool(*) | TEqualOperator(const TGenericTableEntry &, const TEventInfo &) |
Public Member Functions | |
| TRecentFiles (const tstring &iniOrKeyName, int numSavedFiles=MaxMenuItems, int namelen=30, bool useRegistry=false, bool keepFullNameInMenu=true) | |
| Constructor to initialize the external storage and the maximum number of items to save in the most-recently-used (MRU) list. | |
| virtual | ~TRecentFiles () |
| Deletes the allocated profile. | |
| void | SaveMenuChoice (LPCTSTR text) |
| Saves the menu choice into the profile. | |
| void | SaveMenuChoice (const tstring &text) |
| void | RemoveMenuChoice (LPCTSTR text) |
| void | RemoveMenuChoice (const tstring &text) |
| bool | GetMenuText (int id, TCHAR *text, int maxTextLen) |
| Retrieves the text of the choice based on the ID. | |
| tstring | GetMenuText (int id) |
| Retrieves the text of the choice based on the ID. | |
| void | SetMaxMruItems (int maxValue) |
| Sets the maximum number of items that can be saved with this MRU. | |
| void | SetDispLength (const int) |
| void | EnableRegistry (bool enable=true) |
| int | GetMruCount () |
| Returns the number of files that are currently in the MRU list. | |
| Public Member Functions inherited from owl::TEventHandler | |
| virtual bool | Find (TEventInfo &info, TEqualOperator op=0) |
| Searches the list of response table entries looking for a match. | |
| TResult | Dispatch (TEventInfo &info, TParam1, TParam2=0) |
| Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handling function. | |
| TResult | DispatchMsg (TMsgId, uint id, TParam1, TParam2) |
| Search for the event given the message and it and dispatch to the event handler if found. | |
Protected Member Functions | |
| void | CeExit (TCommandEnabler &ce) |
| Reads information in the TProfile to display the menu choices. | |
| void | CmFile (uint id) |
| Responds to a menu item selection. | |
| bool | MruItemsInsertedIntoMenu (HMENU hMenu) |
| Returns true if the menu has any MRU items in it. | |
| void | RemoveMruItemsFromMenu (HMENU hMenu) |
| Removes the MRU items from the menu. | |
| void | InsertMruItemsToMenu (HMENU hMenu) |
| Reads external information and adds the MRU items into the menu. | |
| int | GetMenuPos (HMENU hMenu, uint id) |
| Searches the menu to find the position of a menu item. | |
| int | GetExitMenuPos (HMENU hMenu) |
| Retrieves the menu position of the CM_EXIT menu item. Returns -1 if not found. | |
| void | RemoveMruIndex (int index) |
| Removes the MRU item at index. Shuffles the items below index up. | |
| void | AddMruItem (LPCTSTR text) |
| Adds an item to the top of the MRU list. | |
| void | AddMruItem (const tstring &text) |
| bool | ExistMruItem (LPCTSTR text) |
| Returns true if there are any items in the MRU list that match the text. | |
| bool | ExistMruItem (const tstring &text) |
| int | GetMruItemIndex (LPCTSTR text) |
| Returns the index of the MRU item containing text. Returns -1 if not found. | |
| int | GetMruItemIndex (const tstring &text) |
| Protected Member Functions inherited from owl::TEventHandler | |
| bool | SearchEntries (const TGenericTableEntry *entries, TEventInfo &info, TEqualOperator op) |
| Low-level response table search function. | |
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.
Definition at line 38 of file rcntfile.h.
| anonymous enum |
| Enumerator | |
|---|---|
| MaxMenuItems | |
Definition at line 41 of file rcntfile.h.
| owl::TRecentFiles::TRecentFiles | ( | const tstring & | iniOrKeyName, |
| int | numSavedFiles = MaxMenuItems, | ||
| int | namelen = 30, | ||
| bool | useRegistry = false, | ||
| bool | keepFullNameInMenu = true ) |
Constructor to initialize the external storage and the maximum number of items to save in the most-recently-used (MRU) list.
Definition at line 95 of file rcntfile.cpp.
References owl::TFileName::TFileName(), _T, MaxMenuItems, MruFileMessage, owl::Section, and SetMaxMruItems().
|
virtual |
Deletes the allocated profile.
Definition at line 127 of file rcntfile.cpp.
|
inlineprotected |
Definition at line 75 of file rcntfile.h.
References AddMruItem().
|
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.
Definition at line 362 of file rcntfile.cpp.
References owl::TFileName::TFileName().
|
protected |
Reads information in the TProfile to display the menu choices.
Definition at line 271 of file rcntfile.cpp.
References owl::TCommandEnabler::Enable(), owl::TMenuItemEnabler::GetMenu(), InsertMruItemsToMenu(), RemoveMruItemsFromMenu(), and TYPESAFE_DOWNCAST.
|
protected |
Responds to a menu item selection.
Definition at line 151 of file rcntfile.cpp.
References owl::TApplication::GetMainWindow(), owl::TWindow::SendMessage(), and TYPESAFE_DOWNCAST.
|
inline |
Definition at line 113 of file rcntfile.h.
|
inlineprotected |
Definition at line 77 of file rcntfile.h.
References ExistMruItem().
|
protected |
Returns true if there are any items in the MRU list that match the text.
Definition at line 387 of file rcntfile.cpp.
References GetMruItemIndex().
|
protected |
Retrieves the menu position of the CM_EXIT menu item. Returns -1 if not found.
Definition at line 179 of file rcntfile.cpp.
References GetMenuPos().
|
protected |
Searches the menu to find the position of a menu item.
Definition at line 167 of file rcntfile.cpp.
| tstring owl::TRecentFiles::GetMenuText | ( | int | id | ) |
Retrieves the text of the choice based on the ID.
Definition at line 286 of file rcntfile.cpp.
References _T, and owl::FullFileName.
| bool owl::TRecentFiles::GetMenuText | ( | int | id, |
| TCHAR * | text, | ||
| int | maxTextLen ) |
Retrieves the text of the choice based on the ID.
Definition at line 298 of file rcntfile.cpp.
References _T, _tcslen, _tcsncpy, and owl::FullFileName.
|
inline |
Returns the number of files that are currently in the MRU list.
Definition at line 118 of file rcntfile.h.
|
inlineprotected |
Definition at line 79 of file rcntfile.h.
References GetMruItemIndex().
|
protected |
Returns the index of the MRU item containing text. Returns -1 if not found.
Definition at line 396 of file rcntfile.cpp.
References owl::TFileName::TFileName().
|
protected |
Reads external information and adds the MRU items into the menu.
Adds a separator between the MRU items and the exit menu item.
Definition at line 226 of file rcntfile.cpp.
References owl::TFileName::TFileName(), _T, owl::TFileName::CurrentDir, owl::TFileName::Ext, owl::TFileName::File, owl::FullFileName, owl::FullPathName, GetExitMenuPos(), owl::TMenu::InsertMenu(), and owl::MaxMenuItemLen.
|
protected |
Returns true if the menu has any MRU items in it.
Definition at line 189 of file rcntfile.cpp.
References GetMenuPos().
|
inline |
Definition at line 50 of file rcntfile.h.
References RemoveMenuChoice().
| void owl::TRecentFiles::RemoveMenuChoice | ( | LPCTSTR | text | ) |
Definition at line 329 of file rcntfile.cpp.
References GetMruItemIndex(), and RemoveMruIndex().
|
protected |
Removes the MRU item at index. Shuffles the items below index up.
Definition at line 338 of file rcntfile.cpp.
References _T.
|
protected |
Removes the MRU items from the menu.
Definition at line 199 of file rcntfile.cpp.
References owl::CM_MRU_LAST, GetExitMenuPos(), GetMenuPos(), and MruItemsInsertedIntoMenu().
|
inline |
Definition at line 48 of file rcntfile.h.
References SaveMenuChoice().
| void owl::TRecentFiles::SaveMenuChoice | ( | LPCTSTR | text | ) |
Saves the menu choice into the profile.
Definition at line 318 of file rcntfile.cpp.
References AddMruItem(), GetMruItemIndex(), and RemoveMruIndex().
|
inline |
Definition at line 109 of file rcntfile.h.
| void owl::TRecentFiles::SetMaxMruItems | ( | int | maxValue | ) |
Sets the maximum number of items that can be saved with this MRU.
Definition at line 136 of file rcntfile.cpp.