19#include <owl/window.rh>
20#include <owl/editfile.rh>
25#include <owl/rcntfile.rh>
50uint TRecentFiles::MruMessage = 0;
80 return static_cast<int>(
static_cast<uint32>(*
v));
100 AddedSeparator(
false),
104 keepFullNameInMenu(keepFullNameInMenu)
141 items[
i] = MruNames[
i];
169 for (
int i = ::GetMenuItemCount(menu) - 1;
i >= 0;
i--)
170 if (::GetMenuItemID(menu,
i) ==
id)
203 if (::GetMenuItemID(
hMenu,
exitPos - 1) == 0 && AddedSeparator) {
204 AddedSeparator =
false;
205 if (LastHMenu ==
hMenu)
238 for (
i = 0;
i < MruCount;
i++) {
258 if (AddedSeparator ==
false) {
260 AddedSeparator =
true;
289 if (
id < 0 || MruCount <=
id)
302 if (
id < 0 || MruCount <=
id)
341 if (index < 0 || MruCount <= index)
344 if (index != MruCount - 1) {
347 for(
int i = index;
i < MruCount - 1;
i++)
348 MruNames[
i] = MruNames[
i+1];
353 MruNames[MruCount-1] =
_T(
"");
364 if (MaxFilesToSave <= 0)
369 if(MruCount < MaxFilesToSave)
374 for (
int i = MruCount - 2;
i >= 0;
i--)
375 MruNames[
i+1] = MruNames[
i];
399 for (
int i = 0;
i < MruCount;
i++) {
414 WARN(!
k,
_T(
"Registry key is missing for MRU: HKEY_CURRENT_USER\\") << MruName);
419 MruCount = std::min(
static_cast<int>(
static_cast<uint32>(*
c)), MaxFilesToSave);
420 for (
auto i = 0;
i != MruCount; ++
i)
434 if (MruCount > MaxFilesToSave)
435 MruCount = MaxFilesToSave;
436 for (
int i = 0;
i < MruCount;
i++){
454 auto k = TRegKey{
c, MruName};
CHECK(
k.GetHandle());
456 for (
auto i = 0;
i != MruCount; ++
i)
464 for (
int i = 0;
i < MruCount;
i++){
#define WARN(condition, message)
Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an...
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
TEventHandler is a base class from which you can derive classes that handle messages.
The TFileName class constructs filenames.
@ Device
Logical device or sharename.
@ Path
Directory path to the file.
@ File
Filename part without the extension.
const tstring & Canonical(bool forceUNC=false) const
Return normal fully qualified path string.
const tchar * Squeezed(int maxLen, bool keepName=true) const
Obtains a human-readable form of the filename.
const tchar * GetParts(uint p) const
Reassembles any logical subset of filename parts.
@ CurrentDir
Current working directory if any.
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
An instance of TProfile encapsulates a setting within a system file, often referred to as a profile o...
TRecentFiles implements a most-recent files list, designed to be mixed in with TApplication.
void CeExit(TCommandEnabler &ce)
Reads information in the TProfile to display the menu choices.
void SaveMenuChoice(LPCTSTR text)
Saves the menu choice into the profile.
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.
bool GetMenuText(int id, TCHAR *text, int maxTextLen)
Retrieves the text of the choice based on the ID.
void RemoveMruIndex(int index)
Removes the MRU item at index. Shuffles the items below index up.
virtual ~TRecentFiles()
Deletes the allocated profile.
void SetMaxMruItems(int maxValue)
Sets the maximum number of items that can be saved with this MRU.
void CmFile(uint id)
Responds to a menu item selection.
bool ExistMruItem(LPCTSTR text)
Returns true if there are any items in the MRU list that match the text.
int GetMruItemIndex(LPCTSTR text)
Returns the index of the MRU item containing text. Returns -1 if not found.
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-re...
void RemoveMruItemsFromMenu(HMENU hMenu)
Removes the MRU items from the menu.
void RemoveMenuChoice(LPCTSTR text)
bool MruItemsInsertedIntoMenu(HMENU hMenu)
Returns true if the menu has any MRU items in it.
void AddMruItem(LPCTSTR text)
Adds an item to the top of the MRU list.
static auto GetCurrentUser() -> TRegKey &
Special predefined root key defining the preferences of the current user (HKEY_CURRENT_USER).
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition of class TFrameWindow.
Object Windows Library (OWLNext Core)
const tchar * MaxCountKey
auto to_tstring(const T &v) -> tstring
const tchar * MenuItemDefault
#define TYPESAFE_DOWNCAST(object, toClass)
Various types of smart pointer templatized classes.
Definition of TProfile class.
Definition of TRecentFiles class.
#define MruFileMessage
Derived classes should catch the following registered message to know when an item in the recent list...
General Registry access & registration implementation TRegKey, TRegValue, TRegKeyIterator,...
#define EV_COMMAND_ENABLE(id, method)
Response table entry for enabling a command.
#define EV_COMMAND_AND_ID(id, method)
Response table entry for a menu/accelerator/push button message The menu id is passed in as an argume...