Adding Tabs in Doxygen

There are probably few C/C++ programmers that haven’t heard of Doxygen. It would have to be the most well known documentation generator for those two languages. For me, my first experience with documentation systems was Java’s humble javadoc. Whilst I’ve written a fair amount of C/C++ code (and document’d it), and hadn’t really bothered to learn too much of the underlying documentation system.

Recently I was documenting some code I had written and wanted to add a seperate tab to show some licencing information. It took me a bit of hunting around to find out how to do this - it is mentioned in Doxygen, but some of the information around it is a little unintuitive.

Now, adding a tab itself is actually quite simple, but I wanted doxygen to be able to reference this tab. In my preceding example, I wanted to be able to include


\licence

Here lies some licencing code

Into my main doxygen file and have it know to create a seperate licencing section and link it to the tab.

To do this, you need to edit the doxygenlayout.xml file. At the top, you will have a navindex directive at the top of it, which will probably look something like this:


<navindex>
    <tab type="mainpage" visible="yes" title="Home"/>
    <tab type="modules" visible="yes" title="" intro=""/>
    <tab type="namespaces" visible="yes" title="">
      <tab type="namespacelist" visible="yes" title="" intro=""/>
      <tab type="namespacemembers" visible="yes" title="" intro=""/>
    </tab>
    <tab type="classes" visible="yes" title="">
      <tab type="classlist" visible="yes" title="" intro=""/>
      <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> 
      <tab type="hierarchy" visible="yes" title="" intro=""/>
      <tab type="classmembers" visible="yes" title="" intro=""/>
    </tab>
    <tab type="files" visible="yes" title="">
      <tab type="filelist" visible="yes" title="" intro=""/>
      <tab type="globals" visible="yes" title="" intro=""/>
    </tab>
  </navindex>

Lets add something to it:


<tab type="user" url="@ref licence" visible="yes" title="Licence"/>

This add a “user” defined tab, that is visible (obviously) and is displayed as Licence. The url variable “@ref licence” lets doxygen know to create the licence html page and that any \licence directive will reference that page.