Jump to content

Xwdock 2.0.0.0 - Plugins Development


BOBAH13

Recommended Posts

Hello XWDock developers.

At first, you can found ExampleDocklet in Plugins\ folder. There is XWDAPI.h/.cpp, [project name].def, main.cpp

So, first of all, look at XWDAPI.h. There are 2 functions:

1.

XWDBool XWDAPICALL XWDExec(XWDFunction function, ...);

2.

XWDError XWDAPICALL XWDGetLastError();

As you can see, calling XWDGetLastError, to get detail infromation, it makes sense if XWDExec returns XWDFalse. I think there is no problems with it.

What about XWDExec. This is the main function, which contains all API.

XWDFunction function - you can found this enumeration just above XWDExec's implementation in XWDAPI.h.

Look at it carefully. For example:

XWDGetRootPath,
/*
Return path of the dock

XWDString - result
*/

It means, that to get root folder of XWDock in your plugin you should do following:

XWDString buff;
XWDBool ret = XWDExec(XWDGetRootPath, buff);
if(ret == XWDTrue)
{
// here we have, for example, buff = L"C:\\Program Files\\XWindows Dock\\";
}

The main idea, it's to use Unicode and call all API using the same way (same function XWDExec);

What about a plugin's structure

In .def file you can found these functions:

XWDGetPluginType
XWDGetPluginIcon
XWDGetPluginInformation
XWDPluginInitialize
XWDPluginDeinitialize
XWDPluginEvent

It's also very easy to understand how it works.

1. XWDGetPluginType - just return one of the constants, that describe what destination of your plugin.

2. XWDGetPluginIcon - fill XWDString buff in your icon's name (.ico, .png...) without full path, only name and return XWDTrue if your plugin has the icon, otherwise return XWDFalse.

3. XWDGetPluginInformation - XWDock calls this function when it needs to get to know more details about your plugin (its author, description, version and so on)

4. XWDPluginInitialize - has only one parameter, XWDId id - it's an unique identificator of your plugin. Also, if you want to store your own data, return a pointer on it as a result of the function.

5. XWDPluginDeinitialize - calls when plugin must be shutdown, here you must free your all resources

6. XWDPluginEvent - it's a callback from XWDock to your plugin. Use XWDEvent uEvent - to get to know what happened, and va_list args to get additional parameters (see XWDEvent enumeration).

So, feel free to ask me about new functionality for XWD API, I will be glad to discuss it with you.

Link to comment
  • 1 month later...
  • 4 weeks later...

Hmm... it doesn't metter where you are going to develop plugins! It can be MS VS2005/2008/2010 or even MinGW and other compliers. It's simple C++ (I can even think that it's simple C) cause I don't use any of libraries, it's clear C/C++ language. Just develop it where you feel well.

Link to comment

thanks for tip :P a have some other questions like:

I started to develop a docklet named YahooMessenger that will allow users to add a contact, set online, offline status with just some simple clicks, but being novice in this new style of programing (i know well to program in c, c++ but not visual c) i`m wondering how i can link this plugin that i`m trying to make with the YahooMessenger application so when i click for exemple: "add contact" from the docklet menu then automatically open the add contact window from YMessenger?

Please give me some tips of how to do that? (linking the docklet with the ymessenger application or with some other necessary dll`s from there)

THX in advance! :rolleyes::):D

Link to comment

I don't know YMessenger API, but I think you have to find API first, then using plugin for the dock (item in menu of the dock) call API to add contact to YM. It's problem not mine (not XWD API). It depends on YM API and how they developed and organized everything in it.

Link to comment
  • 1 month later...
  • 2 months later...

how about adding a mouse-enter/-leave event, to be able to update label only when its shown.

You know I think it doesn't make sense, if mouse is out you can call API to update label, dock just replaces the string in memory and anything else. So, it won't take a lot of cpu if you call it always.

Link to comment
  • 1 month later...

Hi All.

I'd like to say that I've started new API for the dock. Why? I've got an idea so that any application (yes, exactly apps/.exe files) can use dock's api. Why not? I think it's cool. It gives to developers use any of the languages available for Windows. Right now and for example, I will use WPF/C#. So, a short example how simple use dock's API right in the application code.

Here is a class of the main window's code

public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);

DockIcon.Initilize(@"5.ico", textBox1.Text); // init with icon and title, it means add new icon of the application
}

protected override void OnClosed(EventArgs e)
{
DockIcon.Dispose();

base.OnClosed(e);
}

private void button1_Click(object sender, RoutedEventArgs e)
{
DockIcon.SetIcon(@"5.ico"); // change icon
}

private void button2_Click(object sender, RoutedEventArgs e)
{
DockIcon.SetIcon(@"6.ico"); // change icon
}

private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
{
DockIcon.SetTitle(textBox1.Text); // change title
}

private void button3_Click(object sender, RoutedEventArgs e)
{
DockIcon.Bounce(DockIcon.BounceType.Normal, 1); // bounce effect
}

private void button4_Click(object sender, RoutedEventArgs e)
{
DockIcon.Bounce(DockIcon.BounceType.Attention, 1); // bounce effect
}
}

Link to comment
  • 2 months later...

Can i override some funtions about xwdocks behaivor, like .... width ?? , i want to create a plugin that can simulate the PANEL MODE like DOCKY in linux ....

I can compile the example plugin ,sais , is missing the def file .... using VS 2010 express .... any problem ??

Yep, there is a problem, ExampleDocklet.def but in project file it's named ExmapleDocklet.def. I think you can simply rename file to ExmapleDocklet.def. And you cannot control behavior of the dock by plugins yet, may in future I'll implement a type of plugins to make possible change behaviour of the dock.

Link to comment

Hi All.

I'd like to say that I've started new API for the dock. Why? I've got an idea so that any application (yes, exactly apps/.exe files) can use dock's api. Why not? I think it's cool. It gives to developers use any of the languages available for Windows. Right now and for example, I will use WPF/C#. So, a short example how simple use dock's API right in the application code.

Here is a class of the main window's code

[...]

Maybe I'm missing something obvious but it seems like it's hard to find the new C# API documentation and/or some full sample code... can anyone help me out?

BOBAH13, have you already ported all of the C function headers to more native C# arguments?

Link to comment

Maybe I'm missing something obvious but it seems like it's hard to find the new C# API documentation and/or some full sample code... can anyone help me out?

BOBAH13, have you already ported all of the C function headers to more native C# arguments?

You can find c# (.cs file) class in sources folder in xwd folder. Just you this class's methods and that's all. What's the problem?

Link to comment
  • 3 weeks later...
  • 1 month later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...