• Immutable Page
  • Info
  • Attachments

BCOP

Construction

The compiz++ version of bcop will now create only a header class with a [Plugin name]Options class. The plugin screen class has to derive from it and call it's constructor with the plugin metadata pointer.

Example:

class FooScreen :
  public FooOptions,
  ...
{
  ...
}

FooScreen::FooScreen (CompScreen *screen) :
  FooOptions (FooVTable->getMetadata ()),
  ...
{
  ...
}

The plugin should then also contain the PLUGIN_OPTION_HELPER macro to its VTable.

Use

Because your screen class is derived from the options class, you'll get all the option getters and setters for free. The method for using options is pretty much similar to the old Compiz BCOP, but with a few small differences.

  • Options are accessed as member functions of a class, not functions on their own.
  • Also, any enums generated by BCOP are members of a class too.
  • There is a new method for naming options,  optionGetOptionName () 

  • You no longer need to provide a  CompScreen * . That is done for you.

Example:

FooScreen::FooFunction (int i)
{
    int j = optionGetFooBar ();
    if i > j
        compLogMessage ("foo", CompLogLevelInfo, "Compiz is better than everything");
    else
        compLogMessage ("foo", CompLogLevelInfo, "Compiz is still better than everything");
}

Development/Compiz++Documentation/C++bcop (last edited 2009-01-14 01:24:03 by CPE-58-161-137-105)