Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] help on ProcessKey!!!



Hi. I would like to write a little plugin but I can't
understand how to manage key events.

I wrote this little code:

cOsdObject *cPluginPic::MainMenuAction(void)
{
  // Perform the action when selected from the main
VDR menu.
        return new cMyMenu();
}



the cMyMenu class is represented by the following
code:

class cMyMenu : public cOsdMenu
{
        private:

        public:
                cOsdBrowser();
                ~cOsdBrowser();
                virtual eOSState ProcessKey(eKeys
Key);
};

cMyMenu::cMyMenu()
:cOsdMenu(".......")
{
	Add(new cMyItem("a", "0001"));
	Add(new cMyItem("b", "0002"));
	Add(new cMyItem("c", "0003"));
}

cMyMenu::~cMyMenu()
{
        // ???
}

eOSState cMyMenu::ProcessKey(eKeys Key)
{
        eOSState state = cOsdMenu::ProcessKey(Key);
        printf("state=%d", state);
        if(Key == kOk)
        {
                cMyItem* ci = (cMyItem
*)Get(Current());
                SetTitle(ci->getCode());
        }
        return osContinue;
}



In natural words this is a class that inserts in a
menu 3 cMyItem objects (defined below).
I want to select the items with the arrows and when I
press OK, I want the code associated
to the Item to go on the title of the menu (yes I know
it's pretty stupid but I want to
do an action when the user selects OK over a specific
menu entry)

class cMyItem : public cOsdItem
{
        private:
                char* code;

        public:
                cOsdBrowserItem(char* name, char*
fileName, int dir);
                ~cOsdBrowserItem();
                const char* getcode();
};

cMyItem::cMyItem(char* name, char* codePar)
{
        SetText(name);
        code = strdup(codePar);
}

cMyItem::~cMyItem()
{
        free(code);
}

const char* cMyItem::getcode()
{
        return code;
}



I need to understand how to write and use the
ProcessKey function, together with the variuous
eOSState values. I think the plugin's documentation is
*excellent* but the rest of vdr
programming is pretty undocumented. I tried to look at
the osurce of vdr itself and some plugins
but it gets quite hard to 'reverse' the way it
works....

thank you for any help



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index