Permalink
Browse files

Updated plugin API

- Added new option to RmGet(): RMG_SKINNAME, RMG_SKINWINDOWHANDLE
  • Loading branch information...
1 parent 71601d7 commit 53f5ceb6743ef8c0127ec602ebb3c439d993ab37 @spx268 spx268 committed Feb 27, 2013
Showing with 48 additions and 5 deletions.
  1. +14 −0 Library/Export.cpp
  2. +19 −2 Plugins/API/RainmeterAPI.cs
  3. +15 −3 Plugins/API/RainmeterAPI.h
View
@@ -78,6 +78,20 @@ void* __stdcall RmGet(void* rm, int type)
{
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;
@@ -64,9 +64,9 @@ public enum LogType
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);
}
@@ -98,6 +98,23 @@ public unsafe IntPtr GetSkin()
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)
{
RmExecute((void*)skin, ToUnsafe(command));
View
@@ -47,9 +47,11 @@ LIBRARY_EXPORT void* __stdcall RmGet(void* rm, int type);
enum RmGetType
{
- RMG_MEASURENAME = 0,
- RMG_SKIN = 1,
- RMG_SETTINGSFILE = 2
+ RMG_MEASURENAME = 0,
+ RMG_SKIN = 1,
+ RMG_SETTINGSFILE = 2,
+ RMG_SKINNAME = 3,
+ RMG_SKINWINDOWHANDLE = 4
};
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);
}
+__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)
{
LSLog(level, NULL, message);

0 comments on commit 53f5ceb

Please sign in to comment.