Difference between revisions of "Managing Plug-in Resources"

From CodeBlocks
Jump to: navigation, search
Line 16: Line 16:
 
==Plugin File Structure==
 
==Plugin File Structure==
  
Every plugin in its undeployed state is a simply nested file structure in compressed archive form (zip). The typical structure of a plugin (which we'll call "my-plugin" in this tutorial is as follows):
+
Every plugin in its undeployed state is simply a nested file structure in compressed archive form (zip). The typical structure of a plugin (which we'll call "myplugin" in this tutorial is as follows):
  
  +my-plugin.cbplugin
+
  +myplugin.cbplugin
   +my-plugin.dll
+
   +myplugin.dll
   +my-plugin.png
+
   +myplugin.png
   +my-plugin-off.png
+
   +myplugin-off.png
   +my-plugin.zip
+
   +myplugin.zip
 
   +manifest.xml
 
   +manifest.xml
   +RESOURCES
+
   +XML Based Resources
   +EXTRA FILES
+
   +Extra Files
  
What are these files?
+
Most of this structure is created automatically when you build a plugin project created with the CB Plugin Wizard. What are these files?
  
* '''my-plugin.cbplugin''': this is simply a zip archive containing all of the plugins files and resources. It is given a cbplugin extension to make it easy for the Code::Blocks plugin installer to recognize.
+
* '''myplugin.cbplugin''': this is simply a zip archive containing all of the plugins files and resources. It is given a cbplugin extension to make it easy for the Code::Blocks plugin installer to recognize.
* '''my-plugin.dll''' (or _libmy-plugin.so_ on linux): the binary shared library file containing you plugins executable content  
+
* '''myplugin.dll''' (or _libmy-plugin.so_ on linux): the compiled shared library containing you plugins executable content  
* '''my-plugin.png''': this is an 80x80 bitmap displayed by default in the image list in "Environment Settings" when the plugins configuration has the focus (for plugins that have a configuaration panel). ''This file is optional''
+
* '''myplugin.png''': this is an 80x80 bitmap displayed by default in the image list in "Environment Settings" when the plugins configuration has the focus (for plugins that have a configuaration panel). ''This file is optional''
* '''my-plugin-off.png''': this is an 80x80 bitmap displayed by default in the image list in "Environment Settings" when the plugins configuration does not have the focus(for plugins that have a configuaration panel). ''This file is optional''
+
* '''myplugin-off.png''': this is an 80x80 bitmap displayed by default in the image list in "Environment Settings" when the plugins configuration does not have the focus(for plugins that have a configuaration panel). ''This file is optional''
* '''my-plugin.zip''': a compressed archive file containing the file manifest.xml and resources
+
* '''myplugin.zip''': a compressed archive file containing the file manifest.xml and resources
 
* '''manifest.xml''': a file containing information about the plugin. (see the [[Creating a simple "Hello_World" plugin]])
 
* '''manifest.xml''': a file containing information about the plugin. (see the [[Creating a simple "Hello_World" plugin]])
* '''RESOURCES''': wxWidgets XML based resource files (XRC files), such as toolbars, dialogs, forms and bitmap images (the latter with an accompanying XRC descriptior) can be placed here. ''These files are optional''
+
* '''XML Based Resources''': One or more wxWidgets XML based resource files (XRC files) such as toolbars, dialogs and forms. You can also place binary bitmap images in this archive if they are accompanied by and XRC descriptor file. ''XML Resources are option''
 
* '''EXTRA FILES''': Place other static, non-XRC resources here. You should keep these files to a mimimum because they are copied to the shared space of the users Code::Blocks installation. ''These files are optional''
 
* '''EXTRA FILES''': Place other static, non-XRC resources here. You should keep these files to a mimimum because they are copied to the shared space of the users Code::Blocks installation. ''These files are optional''
  
==WORKING WITH RESOURCES==
+
==Working with XML Based Resources==
  
 
CONTENT COMING SOON...
 
CONTENT COMING SOON...
  
==WORKING WITH EXTRA FILES==
+
==Working with Extra Files==
  
 
MORE CONTENT COMING SOON...
 
MORE CONTENT COMING SOON...

Revision as of 22:18, 4 July 2007


Prerequisites

Please read the tutorial Creating a simple "Hello_World" plugin before starting this tutorial

This tutorial assumes you have a working version of Code::Blocks installed and some knowledge of how to deal with projects, in particular how to compile them. In order to use the Code::Blocks SDK you must also have a working version of wxWidgets installed. For more information see Compiling wxWidgets 2.6.2 to develop Code::Blocks

To develop Code::Blocks plugins you will also need a copy of the Code::Blocks SDK, which can be found on the Code::Blocks download page. Install this to somewhere sensible that you will remember later on. Personally I keep the SDK in a folder called CodeBlocks\sdk (which contains the include/ and lib/ from in the zip). This means that the header files refered to in the tutorial would be found under Codeblocks\sdk\include, so cbPlugin.h is Codeblocks\sdk\include\cbPlugin.h for example.

Overview

This tutorial will show you how to package Resources (toolbars, forms, dialogs and bitmaps) in your plug-in.

Plugin File Structure

Every plugin in its undeployed state is simply a nested file structure in compressed archive form (zip). The typical structure of a plugin (which we'll call "myplugin" in this tutorial is as follows):

+myplugin.cbplugin
 +myplugin.dll
 +myplugin.png
 +myplugin-off.png
 +myplugin.zip
  +manifest.xml
  +XML Based Resources
 +Extra Files

Most of this structure is created automatically when you build a plugin project created with the CB Plugin Wizard. What are these files?

  • myplugin.cbplugin: this is simply a zip archive containing all of the plugins files and resources. It is given a cbplugin extension to make it easy for the Code::Blocks plugin installer to recognize.
  • myplugin.dll (or _libmy-plugin.so_ on linux): the compiled shared library containing you plugins executable content
  • myplugin.png: this is an 80x80 bitmap displayed by default in the image list in "Environment Settings" when the plugins configuration has the focus (for plugins that have a configuaration panel). This file is optional
  • myplugin-off.png: this is an 80x80 bitmap displayed by default in the image list in "Environment Settings" when the plugins configuration does not have the focus(for plugins that have a configuaration panel). This file is optional
  • myplugin.zip: a compressed archive file containing the file manifest.xml and resources
  • manifest.xml: a file containing information about the plugin. (see the Creating a simple "Hello_World" plugin)
  • XML Based Resources: One or more wxWidgets XML based resource files (XRC files) such as toolbars, dialogs and forms. You can also place binary bitmap images in this archive if they are accompanied by and XRC descriptor file. XML Resources are option
  • EXTRA FILES: Place other static, non-XRC resources here. You should keep these files to a mimimum because they are copied to the shared space of the users Code::Blocks installation. These files are optional

Working with XML Based Resources

CONTENT COMING SOON...

Working with Extra Files

MORE CONTENT COMING SOON...

Further Information

It is essential to learn how wxWidgets works if you seriously plan on working on plugins, since most of Code::Blocks depends on it, and you will find it easier to add and manipulate components if you have a firm grasp of its principles. More information on this can be found in the wxWidgets documentation. Another good place to learn from is the source code from the existing Code::Blocks plugins, which can be downloaded along with the rest of the Code::Blocks source code from the download page.