diff options
author | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-20 02:18:30 +0000 |
---|---|---|
committer | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-20 02:18:30 +0000 |
commit | ff634d35c1fbd2831be6c1206bb9298cd5a14eda (patch) | |
tree | 4442b38df9af9721e73300e9235f868d4adf4261 | |
parent | 283ebdc88fe0867c50f56306bf53dcdeec0da013 (diff) |
skins:
* Updated v8
+ Added tooltips
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@127 c086bb3d-8645-0410-b8da-73a8550f86e7
-rw-r--r-- | Plugins/skins/MirandaFont.cpp | 2 | ||||
-rw-r--r-- | Plugins/skins/MirandaSkinnedDialog.cpp | 12 | ||||
-rw-r--r-- | Plugins/skins/SkinLib/Field.cpp | 10 | ||||
-rw-r--r-- | Plugins/skins/SkinLib/Field.h | 4 | ||||
-rw-r--r-- | Plugins/skins/SkinLib/FieldState.cpp | 17 | ||||
-rw-r--r-- | Plugins/skins/SkinLib/FieldState.h | 5 | ||||
-rw-r--r-- | Plugins/skins/SkinLib/FieldState.rec | 1 | ||||
-rw-r--r-- | Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp | 35 | ||||
-rw-r--r-- | Plugins/skins/libs/v8-debug.h | 4 | ||||
-rw-r--r-- | Plugins/skins/libs/v8.h | 136 | ||||
-rw-r--r-- | Plugins/skins/libs/v8_g.lib | bin | 20584120 -> 20943246 bytes | |||
-rw-r--r-- | Plugins/skins/m_skins.h | 5 | ||||
-rw-r--r-- | Plugins/skins/m_skins_cpp.h | 29 | ||||
-rw-r--r-- | Plugins/skins/skins.cpp | 41 |
14 files changed, 216 insertions, 85 deletions
diff --git a/Plugins/skins/MirandaFont.cpp b/Plugins/skins/MirandaFont.cpp index e8f45d5..877d9b5 100644 --- a/Plugins/skins/MirandaFont.cpp +++ b/Plugins/skins/MirandaFont.cpp @@ -27,7 +27,7 @@ void MirandaFont::registerFont(FontState *font) strncpy(fid.dbSettingsGroup, dlg->getModule(), sizeof(fid.dbSettingsGroup));
char tmp[sizeof(fid.prefix)];
- mir_snprintf(tmp, sizeof(tmp), "%s_%s_Font_", field->getDialog()->getName(), field->getName());
+ mir_snprintf(tmp, sizeof(tmp), "%s_%s_%s_Font_", TcharToChar(dlg->getSkinName()), field->getDialog()->getName(), field->getName());
strncpy(fid.prefix, tmp, sizeof(fid.prefix));
fid.deffontsettings.colour = font->getColor();
diff --git a/Plugins/skins/MirandaSkinnedDialog.cpp b/Plugins/skins/MirandaSkinnedDialog.cpp index 8f9f42a..412a615 100644 --- a/Plugins/skins/MirandaSkinnedDialog.cpp +++ b/Plugins/skins/MirandaSkinnedDialog.cpp @@ -41,12 +41,6 @@ bool MirandaSkinnedDialog::finishedConfiguring() if (getDefaultState() == NULL || getOpts() == NULL)
return false;
- for(unsigned int i = 0; i < getFieldCount(); ++i)
- {
- MirandaField *field = dynamic_cast<MirandaField *>(getField(i));
- field->configure();
- }
-
return true;
}
@@ -224,6 +218,12 @@ int MirandaSkinnedDialog::compile() opt->setOnChangeCallback(&staticOnOptionChange, this);
}
+ for(unsigned int i = 0; i < getFieldCount(); ++i)
+ {
+ MirandaField *field = dynamic_cast<MirandaField *>(getField(i));
+ field->configure();
+ }
+
fireOnSkinChanged();
}
diff --git a/Plugins/skins/SkinLib/Field.cpp b/Plugins/skins/SkinLib/Field.cpp index 6e36241..24b823b 100644 --- a/Plugins/skins/SkinLib/Field.cpp +++ b/Plugins/skins/SkinLib/Field.cpp @@ -33,6 +33,16 @@ void Field::setEnabled(bool enabled) fireOnChange();
}
+const TCHAR * Field::getToolTip() const
+{
+ return tooltip.c_str();
+}
+
+void Field::setToolTip(const TCHAR *tooltip)
+{
+ this->tooltip = tooltip;
+}
+
void Field::setOnChangeCallback(FieldCallback cb, void *param /*= NULL*/)
{
onChangeCallback = cb;
diff --git a/Plugins/skins/SkinLib/Field.h b/Plugins/skins/SkinLib/Field.h index e3bd499..4cf7faa 100644 --- a/Plugins/skins/SkinLib/Field.h +++ b/Plugins/skins/SkinLib/Field.h @@ -40,6 +40,9 @@ public: virtual bool isEnabled() const;
virtual void setEnabled(bool enabled);
+ virtual const TCHAR * getToolTip() const;
+ virtual void setToolTip(const TCHAR *tooltip);
+
virtual FieldState * createState(DialogState *dialogState) = 0;
virtual void setOnChangeCallback(FieldCallback cb, void *param = NULL);
@@ -51,6 +54,7 @@ private: Dialog *dlg;
const std::string name;
bool enabled;
+ std::tstring tooltip;
FieldCallback onChangeCallback;
void *onChangeCallbackParam;
diff --git a/Plugins/skins/SkinLib/FieldState.cpp b/Plugins/skins/SkinLib/FieldState.cpp index 8af110c..5a8b493 100644 --- a/Plugins/skins/SkinLib/FieldState.cpp +++ b/Plugins/skins/SkinLib/FieldState.cpp @@ -14,7 +14,8 @@ FieldState::FieldState(DialogState *aDialog, Field *aField)
: field(aField), dialog(aDialog), size(-1, -1), pos(0, 0),
- usingX(0), usingY(0), visible(aField->isEnabled()), borders(0,0,0,0)
+ usingX(0), usingY(0), visible(aField->isEnabled()), borders(0,0,0,0),
+ tooltipSet(false)
{
}
@@ -194,6 +195,20 @@ void FieldState::setBottom(int botom) SET(usingY, END);
}
+const TCHAR * FieldState::getToolTip() const
+{
+ if (tooltipSet)
+ return tooltip.c_str();
+ else
+ return field->getToolTip();
+}
+
+void FieldState::setToolTip(const TCHAR *tooltip)
+{
+ this->tooltip = tooltip;
+ tooltipSet = true;
+}
+
BorderState * FieldState::getBorders()
{
return &borders;
diff --git a/Plugins/skins/SkinLib/FieldState.h b/Plugins/skins/SkinLib/FieldState.h index 4bbe3b4..ff54e54 100644 --- a/Plugins/skins/SkinLib/FieldState.h +++ b/Plugins/skins/SkinLib/FieldState.h @@ -55,6 +55,9 @@ public: virtual bool isEnabled() const;
+ virtual const TCHAR * getToolTip() const;
+ virtual void setToolTip(const TCHAR *tooltip);
+
virtual BorderState * getBorders();
virtual const BorderState * getBorders() const;
@@ -77,6 +80,8 @@ protected: int usingY;
bool visible;
BorderState borders;
+ bool tooltipSet;
+ std::tstring tooltip;
int getHorizontalBorders() const;
int getVerticalBorders() const;
diff --git a/Plugins/skins/SkinLib/FieldState.rec b/Plugins/skins/SkinLib/FieldState.rec index ca1998d..992c4d6 100644 --- a/Plugins/skins/SkinLib/FieldState.rec +++ b/Plugins/skins/SkinLib/FieldState.rec @@ -22,6 +22,7 @@ struct FieldState Int32 bottom;
Boolean visible;
const Boolean enabled;
+ Char toolTip[128];
};
struct ControlFieldState
diff --git a/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp b/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp index 7217a2e..a4213b1 100644 --- a/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp +++ b/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp @@ -2,6 +2,7 @@ #include "FieldState_v8_wrapper.h"
#include <v8.h>
#include "FieldState.h"
+#include <utf8_helpers.h>
using namespace v8;
@@ -298,6 +299,39 @@ static Handle<Value> Get_FieldState_enabled(Local<String> property, const Access }
+static Handle<Value> Get_FieldState_toolTip(Local<String> property, const AccessorInfo &info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
+ FieldState *tmp = (FieldState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
+ return String::New((const V8_TCHAR *) tmp->getToolTip());
+}
+
+static void Set_FieldState_toolTip(Local<String> property, Local<Value> value, const AccessorInfo& info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return;
+
+ FieldState *tmp = (FieldState *) wrap->Value();
+ if (tmp == NULL)
+ return;
+
+ if (!value.IsEmpty() && value->IsString())
+ {
+ String::Utf8Value utf8_value(value);
+ tmp->setToolTip(Utf8ToTchar(*utf8_value));
+ }
+}
+
+
void AddFieldStateAcessors(Handle<ObjectTemplate> &templ)
{
templ->SetAccessor(String::New("x"), Get_FieldState_x, Set_FieldState_x);
@@ -310,4 +344,5 @@ void AddFieldStateAcessors(Handle<ObjectTemplate> &templ) templ->SetAccessor(String::New("bottom"), Get_FieldState_bottom, Set_FieldState_bottom);
templ->SetAccessor(String::New("visible"), Get_FieldState_visible, Set_FieldState_visible);
templ->SetAccessor(String::New("enabled"), Get_FieldState_enabled, NULL, Handle<Value>(), DEFAULT, ReadOnly);
+ templ->SetAccessor(String::New("toolTip"), Get_FieldState_toolTip, Set_FieldState_toolTip);
}
diff --git a/Plugins/skins/libs/v8-debug.h b/Plugins/skins/libs/v8-debug.h index 68f84c4..16991e4 100644 --- a/Plugins/skins/libs/v8-debug.h +++ b/Plugins/skins/libs/v8-debug.h @@ -28,10 +28,6 @@ #ifndef V8_DEBUG_H_
#define V8_DEBUG_H_
-#define _CRTDBG_MAP_ALLOC
-#include <stdlib.h>
-#include <crtdbg.h>
-
#include "v8.h"
#ifdef _WIN32
diff --git a/Plugins/skins/libs/v8.h b/Plugins/skins/libs/v8.h index 01d31d4..24ea84b 100644 --- a/Plugins/skins/libs/v8.h +++ b/Plugins/skins/libs/v8.h @@ -200,11 +200,11 @@ template <class T> class EXPORT_INLINE Handle { /**
* Returns true if the handle is empty.
*/
- bool IsEmpty() { return val_ == 0; }
+ bool IsEmpty() const { return val_ == 0; }
- T* operator->();
+ T* operator->() const;
- T* operator*();
+ T* operator*() const;
/**
* Sets the handle to be empty. IsEmpty() will then return true.
@@ -217,7 +217,7 @@ template <class T> class EXPORT_INLINE Handle { * to which they refer are identical.
* The handles' references are not checked.
*/
- template <class S> bool operator==(Handle<S> that) {
+ template <class S> bool operator==(Handle<S> that) const {
void** a = reinterpret_cast<void**>(**this);
void** b = reinterpret_cast<void**>(*that);
if (a == 0) return b == 0;
@@ -231,7 +231,7 @@ template <class T> class EXPORT_INLINE Handle { * the objects to which they refer are different.
* The handles' references are not checked.
*/
- template <class S> bool operator!=(Handle<S> that) {
+ template <class S> bool operator!=(Handle<S> that) const {
return !operator==(that);
}
@@ -367,12 +367,12 @@ template <class T> class EXPORT_INLINE Persistent : public Handle<T> { /**
*Checks if the handle holds the only reference to an object.
*/
- bool IsNearDeath();
+ bool IsNearDeath() const;
/**
* Returns true if the handle's reference is weak.
*/
- bool IsWeak();
+ bool IsWeak() const;
private:
friend class ImplementationUtilities;
@@ -556,39 +556,39 @@ class EXPORT Script { */
class EXPORT Message {
public:
- Local<String> Get();
- Local<String> GetSourceLine();
+ Local<String> Get() const;
+ Local<String> GetSourceLine() const;
- Handle<Value> GetScriptResourceName();
+ Handle<Value> GetScriptResourceName() const;
/**
* Returns the number, 1-based, of the line where the error occurred.
*/
- int GetLineNumber();
+ int GetLineNumber() const;
/**
* Returns the index within the script of the first character where
* the error occurred.
*/
- int GetStartPosition();
+ int GetStartPosition() const;
/**
* Returns the index within the script of the last character where
* the error occurred.
*/
- int GetEndPosition();
+ int GetEndPosition() const;
/**
* Returns the index within the line of the first character where
* the error occurred.
*/
- int GetStartColumn();
+ int GetStartColumn() const;
/**
* Returns the index within the line of the last character where
* the error occurred.
*/
- int GetEndColumn();
+ int GetEndColumn() const;
// TODO(1245381): Print to a string instead of on a FILE.
static void PrintCurrentStackTrace(FILE* out);
@@ -608,94 +608,94 @@ class EXPORT Value : public Data { * Returns true if this value is the undefined value. See ECMA-262
* 4.3.10.
*/
- bool IsUndefined();
+ bool IsUndefined() const;
/**
* Returns true if this value is the null value. See ECMA-262
* 4.3.11.
*/
- bool IsNull();
+ bool IsNull() const;
/**
* Returns true if this value is true.
*/
- bool IsTrue();
+ bool IsTrue() const;
/**
* Returns true if this value is false.
*/
- bool IsFalse();
+ bool IsFalse() const;
/**
* Returns true if this value is an instance of the String type.
* See ECMA-262 8.4.
*/
- bool IsString();
+ bool IsString() const;
/**
* Returns true if this value is a function.
*/
- bool IsFunction();
+ bool IsFunction() const;
/**
* Returns true if this value is an array.
*/
- bool IsArray();
+ bool IsArray() const;
/**
* Returns true if this value is an object.
*/
- bool IsObject();
+ bool IsObject() const;
/**
* Returns true if this value is boolean.
*/
- bool IsBoolean();
+ bool IsBoolean() const;
/**
* Returns true if this value is a number.
*/
- bool IsNumber();
+ bool IsNumber() const;
/**
* Returns true if this value is external.
*/
- bool IsExternal();
+ bool IsExternal() const;
/**
* Returns true if this value is a 32-bit signed integer.
*/
- bool IsInt32();
+ bool IsInt32() const;
/**
* Returns true if this value is a Date.
*/
- bool IsDate();
+ bool IsDate() const;
- Local<Boolean> ToBoolean();
- Local<Number> ToNumber();
- Local<String> ToString();
- Local<String> ToDetailString();
- Local<Object> ToObject();
- Local<Integer> ToInteger();
- Local<Uint32> ToUint32();
- Local<Int32> ToInt32();
+ Local<Boolean> ToBoolean() const;
+ Local<Number> ToNumber() const;
+ Local<String> ToString() const;
+ Local<String> ToDetailString() const;
+ Local<Object> ToObject() const;
+ Local<Integer> ToInteger() const;
+ Local<Uint32> ToUint32() const;
+ Local<Int32> ToInt32() const;
/**
* Attempts to convert a string to an array index.
* Returns an empty handle if the conversion fails.
*/
- Local<Uint32> ToArrayIndex();
+ Local<Uint32> ToArrayIndex() const;
- bool BooleanValue();
- double NumberValue();
- int64_t IntegerValue();
- uint32_t Uint32Value();
- int32_t Int32Value();
+ bool BooleanValue() const;
+ double NumberValue() const;
+ int64_t IntegerValue() const;
+ uint32_t Uint32Value() const;
+ int32_t Int32Value() const;
/** JS == */
- bool Equals(Handle<Value> that);
- bool StrictEquals(Handle<Value> that);
+ bool Equals(Handle<Value> that) const;
+ bool StrictEquals(Handle<Value> that) const;
};
@@ -711,7 +711,7 @@ class EXPORT Primitive : public Value { }; */
class EXPORT Boolean : public Primitive {
public:
- bool Value();
+ bool Value() const;
static inline Handle<Boolean> New(bool value);
};
@@ -725,13 +725,13 @@ class EXPORT String : public Primitive { /**
* Returns the number of characters in this string.
*/
- int Length();
+ int Length() const;
/**
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
- int Utf8Length();
+ int Utf8Length() const;
/**
* Write the contents of the string to an external buffer.
@@ -750,19 +750,19 @@ class EXPORT String : public Primitive { * \return The number of characters copied to the buffer
* excluding the NULL terminator.
*/
- int Write(uint16_t* buffer, int start = 0, int length = -1); // UTF-16
- int WriteAscii(char* buffer, int start = 0, int length = -1); // ASCII
- int WriteUtf8(char* buffer, int length = -1); // UTF-8
+ int Write(uint16_t* buffer, int start = 0, int length = -1) const; // UTF-16
+ int WriteAscii(char* buffer, int start = 0, int length = -1) const; // ASCII
+ int WriteUtf8(char* buffer, int length = -1) const; // UTF-8
/**
* Returns true if the string is external
*/
- bool IsExternal();
+ bool IsExternal() const;
/**
* Returns true if the string is both external and ascii
*/
- bool IsExternalAscii();
+ bool IsExternalAscii() const;
/**
* An ExternalStringResource is a wrapper around a two-byte string
* buffer that resides outside V8's heap. Implement an
@@ -822,13 +822,13 @@ class EXPORT String : public Primitive { * Get the ExternalStringResource for an external string. Only
* valid if IsExternal() returns true.
*/
- ExternalStringResource* GetExternalStringResource();
+ ExternalStringResource* GetExternalStringResource() const;
/**
* Get the ExternalAsciiStringResource for an external ascii string.
* Only valid if IsExternalAscii() returns true.
*/
- ExternalAsciiStringResource* GetExternalAsciiStringResource();
+ ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
static String* Cast(v8::Value* obj);
@@ -938,7 +938,7 @@ class EXPORT String : public Primitive { */
class EXPORT Number : public Primitive {
public:
- double Value();
+ double Value() const;
static Local<Number> New(double value);
static Number* Cast(v8::Value* obj);
private:
@@ -952,7 +952,7 @@ class EXPORT Number : public Primitive { class EXPORT Integer : public Number {
public:
static Local<Integer> New(int32_t value);
- int64_t Value();
+ int64_t Value() const;
static Integer* Cast(v8::Value* obj);
private:
Integer();
@@ -964,7 +964,7 @@ class EXPORT Integer : public Number { */
class EXPORT Int32 : public Integer {
public:
- int32_t Value();
+ int32_t Value() const;
private:
Int32();
};
@@ -975,7 +975,7 @@ class EXPORT Int32 : public Integer { */
class EXPORT Uint32 : public Integer {
public:
- uint32_t Value();
+ uint32_t Value() const;
private:
Uint32();
};
@@ -992,7 +992,7 @@ class EXPORT Date : public Value { * A specialization of Value::NumberValue that is more efficient
* because we know the structure of this object.
*/
- double NumberValue();
+ double NumberValue() const;
static Date* Cast(v8::Value* obj);
};
@@ -1087,7 +1087,7 @@ class EXPORT Object : public Value { */
class EXPORT Array : public Object {
public:
- uint32_t Length();
+ uint32_t Length() const;
static Local<Array> New(int length = 0);
static Array* Cast(Value* obj);
@@ -1101,11 +1101,11 @@ class EXPORT Array : public Object { */
class EXPORT Function : public Object {
public:
- Local<Object> NewInstance();
- Local<Object> NewInstance(int argc, Handle<Value> argv[]);
+ Local<Object> NewInstance() const;
+ Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
void SetName(Handle<String> name);
- Handle<Value> GetName();
+ Handle<Value> GetName() const;
static Function* Cast(Value* obj);
private:
Function();
@@ -1121,7 +1121,7 @@ class EXPORT External : public Value { public:
static Local<External> New(void* value);
static External* Cast(Value* obj);
- void* Value();
+ void* Value() const;
private:
External();
};
@@ -2322,14 +2322,14 @@ Persistent<T> Persistent<T>::New(Handle<T> that) { template <class T>
-bool Persistent<T>::IsNearDeath() {
+bool Persistent<T>::IsNearDeath() const {
if (this->IsEmpty()) return false;
return V8::IsGlobalNearDeath(reinterpret_cast<void**>(**this));
}
template <class T>
-bool Persistent<T>::IsWeak() {
+bool Persistent<T>::IsWeak() const {
if (this->IsEmpty()) return false;
return V8::IsGlobalWeak(reinterpret_cast<void**>(**this));
}
@@ -2356,13 +2356,13 @@ void Persistent<T>::ClearWeak() { }
template <class T>
-T* Handle<T>::operator->() {
+T* Handle<T>::operator->() const {
return val_;
}
template <class T>
-T* Handle<T>::operator*() {
+T* Handle<T>::operator*() const {
return val_;
}
diff --git a/Plugins/skins/libs/v8_g.lib b/Plugins/skins/libs/v8_g.lib Binary files differindex 1a400b5..62d3150 100644 --- a/Plugins/skins/libs/v8_g.lib +++ b/Plugins/skins/libs/v8_g.lib diff --git a/Plugins/skins/m_skins.h b/Plugins/skins/m_skins.h index 7011b82..31bdd6c 100644 --- a/Plugins/skins/m_skins.h +++ b/Plugins/skins/m_skins.h @@ -63,6 +63,8 @@ struct SKIN_INTERFACE // Field methods
void (*SetEnabled)(SKINNED_FIELD field, BOOL enabled);
+ void (*SetToolTipA)(SKINNED_FIELD field, const char *tooltip);
+ void (*SetToolTipW)(SKINNED_FIELD field, const WCHAR *tooltip);
// TextField methods
void (*SetTextA)(SKINNED_FIELD field, const char *text);
@@ -76,7 +78,6 @@ struct SKIN_INTERFACE // Run the skin and get an state from it
SKINNED_DIALOG_STATE (*Run)(SKINNED_DIALOG dialog);
-// void (*DeleteDialogState)(SKINNED_DIALOG_STATE dialog);
// Dialog State methods
SKINNED_FIELD_STATE (*GetFieldState)(SKINNED_DIALOG_STATE dlg, const char *name);
@@ -87,6 +88,8 @@ struct SKIN_INTERFACE RECT (*GetInsideRect)(SKINNED_FIELD_STATE field); // Without borders
RECT (*GetBorders)(SKINNED_FIELD_STATE field);
BOOL (*IsVisible)(SKINNED_FIELD_STATE field);
+ char * (*GetToolTipA)(SKINNED_FIELD field); // You have to free the result
+ WCHAR * (*GetToolTipW)(SKINNED_FIELD field); // You have to free the result
// TextField State methods
char * (*GetTextA)(SKINNED_FIELD_STATE field); // You have to free the result
diff --git a/Plugins/skins/m_skins_cpp.h b/Plugins/skins/m_skins_cpp.h index e398f52..a1e5756 100644 --- a/Plugins/skins/m_skins_cpp.h +++ b/Plugins/skins/m_skins_cpp.h @@ -30,6 +30,7 @@ class SkinFieldState {
public:
SkinFieldState(SKINNED_FIELD_STATE field) { this->field = field; }
+ virtual ~SkinFieldState() { if (tooltip != NULL) mir_free(tooltip); }
BOOL isValid() { return field != NULL; }
@@ -38,15 +39,28 @@ public: RECT getBorders() { return mski.GetBorders(field); }
BOOL isVisible() { return mski.IsVisible(field); }
+ const TCHAR * getToolTip() {
+ if (tooltip != NULL)
+ mir_free(tooltip);
+
+#ifdef UNICODE
+ tooltip = mski.GetToolTipW(field);
+#else
+ tooltip = mski.GetToolTipA(field);
+#endif
+ return tooltip;
+ }
+
protected:
SKINNED_FIELD_STATE field;
+ TCHAR *tooltip;
};
class SkinTextFieldState : public SkinFieldState
{
public:
SkinTextFieldState(SKINNED_FIELD_STATE field) : SkinFieldState(field), text(NULL) {}
- ~SkinTextFieldState() { if (text != NULL) mir_free(text); }
+ virtual ~SkinTextFieldState() { if (text != NULL) mir_free(text); }
const TCHAR * getText() {
if (text != NULL)
@@ -57,7 +71,7 @@ public: #else
text = mski.GetTextA(field);
#endif
- return text;
+ return text;
}
HFONT getFont() { return mski.GetFont(field); }
@@ -89,12 +103,12 @@ class SkinDialogState {
public:
SkinDialogState(SKINNED_DIALOG_STATE dlg) { this->dlg = dlg; }
-// ~SkinDialogState() { mski.DeleteDialogState(dlg); dlg = NULL; }
BOOL isValid() { return dlg != NULL; }
RECT getBorders() { return mski.GetDialogBorders(dlg); }
+ SkinFieldState getField(const char *name) { return SkinFieldState( mski.GetFieldState(dlg, name) ); }
SkinTextFieldState getTextField(const char *name) { return SkinTextFieldState( mski.GetFieldState(dlg, name) ); }
SkinIconFieldState getIconField(const char *name) { return SkinIconFieldState( mski.GetFieldState(dlg, name) ); }
SkinImageFieldState getImageField(const char *name) { return SkinImageFieldState( mski.GetFieldState(dlg, name) ); }
@@ -113,6 +127,14 @@ public: void setEnabled(BOOL enabled) { mski.SetEnabled(field, enabled); }
+ void setToolTip(const TCHAR *tooltip) {
+#ifdef UNICODE
+ mski.SetToolTipW(field, tooltip);
+#else
+ mski.SetToolTipA(field, tooltip);
+#endif
+ }
+
protected:
SKINNED_FIELD field;
};
@@ -166,6 +188,7 @@ public: SkinIconField addIconField(const char *name, const char *description) { return SkinIconField( mski.AddIconField(dlg, name, description) ); }
SkinImageField addImageField(const char *name, const char *description) { return SkinImageField( mski.AddImageField(dlg, name, description) ); }
+ SkinField getField(const char *name) { return SkinField( mski.GetField(dlg, name) ); }
SkinTextField getTextField(const char *name) { return SkinTextField( mski.GetField(dlg, name) ); }
SkinIconField getIconField(const char *name) { return SkinIconField( mski.GetField(dlg, name) ); }
SkinImageField getImageField(const char *name) { return SkinImageField( mski.GetField(dlg, name) ); }
diff --git a/Plugins/skins/skins.cpp b/Plugins/skins/skins.cpp index 793fb14..da45f6d 100644 --- a/Plugins/skins/skins.cpp +++ b/Plugins/skins/skins.cpp @@ -504,6 +504,24 @@ void Interface_SetEnabled(SKINNED_FIELD aField, BOOL enabled) field->setEnabled(enabled != 0);
}
+void Interface_SetToolTipA(SKINNED_FIELD aField, const char *tooltip)
+{
+ if (aField == NULL)
+ return;
+
+ Field *field = (Field *) aField;
+ field->setToolTip(CharToTchar(tooltip));
+}
+
+void Interface_SetToolTipW(SKINNED_FIELD aField, const WCHAR *tooltip)
+{
+ if (aField == NULL)
+ return;
+
+ Field *field = (Field *) aField;
+ field->setToolTip(WcharToTchar(tooltip));
+}
+
void Interface_SetTextA(SKINNED_FIELD aField, const char *text)
{
if (aField == NULL)
@@ -673,6 +691,24 @@ BOOL Interface_IsVisible(SKINNED_FIELD_STATE field) return fieldState->isVisible();
}
+char * Interface_GetToolTipA(SKINNED_FIELD_STATE field)
+{
+ if (field == NULL)
+ return NULL;
+
+ FieldState *fieldState = (FieldState *) field;
+ return TcharToChar(fieldState->getToolTip()).detach();
+}
+
+WCHAR * Interface_GetToolTipW(SKINNED_FIELD_STATE field)
+{
+ if (field == NULL)
+ return NULL;
+
+ FieldState *fieldState = (FieldState *) field;
+ return TcharToWchar(fieldState->getToolTip()).detach();
+}
+
char * Interface_GetTextA(SKINNED_FIELD_STATE field)
{
if (field == NULL)
@@ -821,6 +857,8 @@ static int Service_GetInterface(WPARAM wParam, LPARAM lParam) mski->SetDialogSize = &Interface_SetDialogSize;
mski->SetEnabled = &Interface_SetEnabled;
+ mski->SetToolTipA = &Interface_SetToolTipA;
+ mski->SetToolTipW = &Interface_SetToolTipW;
mski->SetTextA = &Interface_SetTextA;
mski->SetTextW = &Interface_SetTextW;
@@ -830,7 +868,6 @@ static int Service_GetInterface(WPARAM wParam, LPARAM lParam) mski->SetImage = &Interface_SetImage;
mski->Run = &Interface_Run;
-// mski->DeleteDialogState = &Interface_DeleteDialogState;
mski->GetFieldState = &Interface_GetFieldState;
mski->GetDialogBorders = &Interface_GetDialogBorders;
@@ -839,6 +876,8 @@ static int Service_GetInterface(WPARAM wParam, LPARAM lParam) mski->GetInsideRect = &Interface_GetInsideRect;
mski->GetBorders = &Interface_GetBorders;
mski->IsVisible = &Interface_IsVisible;
+ mski->GetToolTipA = &Interface_GetToolTipA;
+ mski->GetToolTipW = &Interface_GetToolTipW;
mski->GetTextA = &Interface_GetTextA;
mski->GetTextW = &Interface_GetTextW;
|