Updated plugin API

- Added new option to RmGet(): RMG_SKINNAME, RMG_SKINWINDOWHANDLE
This commit is contained in:
spx 2013-02-27 20:00:26 +09:00
parent 71601d7564
commit 53f5ceb674
3 changed files with 48 additions and 5 deletions

View File

@ -78,6 +78,20 @@ void* __stdcall RmGet(void* rm, int type)
{ {
return (void*)Rainmeter->GetDataFile().c_str(); return (void*)Rainmeter->GetDataFile().c_str();
} }
case RMG_SKINNAME:
{
CMeterWindow* window = measure->GetMeterWindow();
if (!window) break;
return (void*)window->GetFolderPath().c_str();
}
case RMG_SKINWINDOWHANDLE:
{
CMeterWindow* window = measure->GetMeterWindow();
if (!window) break;
return (void*)window->GetWindow();
}
} }
return NULL; return NULL;

View File

@ -64,9 +64,9 @@ namespace Rainmeter
Debug = 4 Debug = 4
} }
public unsafe string ReadString(string option, string defValue) public unsafe string ReadString(string option, string defValue, bool replaceMeasures = true)
{ {
char* value = RmReadString((void*)m_Rm, ToUnsafe(option), ToUnsafe(defValue), 1); char* value = RmReadString((void*)m_Rm, ToUnsafe(option), ToUnsafe(defValue), replaceMeasures ? 1 : 0);
return new string(value); return new string(value);
} }
@ -98,6 +98,23 @@ namespace Rainmeter
return (IntPtr)RmGet((void*)m_Rm, 1); return (IntPtr)RmGet((void*)m_Rm, 1);
} }
public unsafe string GetSettingsFile()
{
char* value = (char*)RmGet((void*)m_Rm, 2);
return new string(value);
}
public unsafe string GetSkinName()
{
char* value = (char*)RmGet((void*)m_Rm, 3);
return new string(value);
}
public unsafe IntPtr GetSkinWindow()
{
return (IntPtr)RmGet((void*)m_Rm, 4);
}
public static unsafe void Execute(IntPtr skin, string command) public static unsafe void Execute(IntPtr skin, string command)
{ {
RmExecute((void*)skin, ToUnsafe(command)); RmExecute((void*)skin, ToUnsafe(command));

View File

@ -47,9 +47,11 @@ LIBRARY_EXPORT void* __stdcall RmGet(void* rm, int type);
enum RmGetType enum RmGetType
{ {
RMG_MEASURENAME = 0, RMG_MEASURENAME = 0,
RMG_SKIN = 1, RMG_SKIN = 1,
RMG_SETTINGSFILE = 2 RMG_SETTINGSFILE = 2,
RMG_SKINNAME = 3,
RMG_SKINWINDOWHANDLE = 4
}; };
LIBRARY_EXPORT BOOL LSLog(int type, LPCWSTR unused, LPCWSTR message); LIBRARY_EXPORT BOOL LSLog(int type, LPCWSTR unused, LPCWSTR message);
@ -90,6 +92,16 @@ __inline void* RmGetSkin(void* rm)
return (void*)RmGet(rm, RMG_SKIN); return (void*)RmGet(rm, RMG_SKIN);
} }
__inline LPCWSTR RmGetSkinName(void* rm)
{
return (LPCWSTR)RmGet(rm, RMG_SKINNAME);
}
__inline void* RmGetSkinWindow(void* rm)
{
return (void*)RmGet(rm, RMG_SKINWINDOWHANDLE);
}
__inline void RmLog(int level, LPCWSTR message) __inline void RmLog(int level, LPCWSTR message)
{ {
LSLog(level, NULL, message); LSLog(level, NULL, message);