Jump to content


Photo
* * * * * 2 votes

Xwdock 2.0.0.0 - Plugins Development


  • Please log in to reply
34 replies to this topic

#1 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 24 January 2010 - 12:03 PM

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.
  • 0

#2 xstriga

xstriga
  • Member
  • 12 posts

Posted 23 March 2010 - 10:05 AM

Is possible to create a plugin in c# ?
  • 0

#3 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 23 March 2010 - 12:46 PM

Of course, but to do it you should rewrite XWDAPI.h/.cpp to C# and exports functions.
  • 0

#4 xstriga

xstriga
  • Member
  • 12 posts

Posted 24 March 2010 - 04:41 PM

Of course, but to do it you should rewrite XWDAPI.h/.cpp to C# and exports functions.


Well I manage alone or give me a hand ?
  • 0

#5 vlad0007

vlad0007
  • Member
  • 2 posts

Posted 20 April 2010 - 11:11 AM

hey i`m wondering what version of visual c are you using to develop the plugins in this exemple?
  • 0

#6 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 20 April 2010 - 01:50 PM

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.
  • 0

#7 vlad0007

vlad0007
  • Member
  • 2 posts

Posted 21 April 2010 - 08:07 AM

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
  • 0

#8 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 21 April 2010 - 09:50 AM

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.
  • 0

#9 YOUR MOM

YOUR MOM
  • Recruit
  • 6 posts

Posted 12 June 2010 - 03:24 AM

How do you make skins? I know there was a skin maker in XWDock 5.something, but how do you do that in 2.0.2?
Never mind. I figured it out.


Life sucks. Suck it up and deal with it.

Edited by YOUR MOM, 20 July 2010 - 03:29 AM.

  • 0

#10 krizzmp

krizzmp
  • Member
  • 8 posts

Posted 25 August 2010 - 07:33 PM

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

Edited by krizzmp, 25 August 2010 - 07:34 PM.

  • 0

#11 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 26 August 2010 - 04:56 AM

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.
  • 0

#12 Mingger

Mingger
  • Recruit
  • 3 posts

Posted 26 August 2010 - 01:32 PM

Can you make the genie effect plugin for me ? i would be so grateful ;b

Thanks
  • 0

#13 ramonflores

ramonflores
  • Member
  • 58 posts

Posted 26 August 2010 - 03:20 PM

Can you make the genie effect plugin for me ? i would be so grateful ;b

Thanks

___________________________________________________

LOL what a cut question..
  • 0

#14 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 26 August 2010 - 04:25 PM

Can you make the genie effect plugin for me ? i would be so grateful ;b

Thanks


Yes, strange question in this topic :)
  • 0

#15 KyOliver

KyOliver
  • Recruit
  • 3 posts

Posted 28 August 2010 - 01:47 PM

Is it possible to add entries on dock by using a plugin? And is it possible to resize dock by a command within a plugin?
  • 0

#16 prodo123

prodo123
  • Member
  • 17 posts

Posted 30 August 2010 - 06:50 PM

How about a iCal docklet?
  • 0

#17 Feynman Zhu

Feynman Zhu
  • Recruit
  • 1 posts

Posted 26 October 2010 - 02:53 PM

Thanks a lot~~
  • 0

#18 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 27 October 2010 - 09:19 PM

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
        }
    }

  • 0

#19 Suicidalpain

Suicidalpain
  • Recruit
  • 1 posts

Posted 28 December 2010 - 01:57 AM

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 ??

Edited by Suicidalpain, 28 December 2010 - 11:27 PM.

  • 0

#20 BOBAH13

BOBAH13
  • Developers
  • 465 posts

Posted 30 December 2010 - 06:32 AM

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.
  • 0