title: How to do Bold, Italic, Underline buttons in Gtk# aka How to dynamically format text in gtk
body: <p>Maybe this is a little to broad or vague of a question.</p>
  
  <p>I can't find anything that makes sense to me online, I am working with Gtk2.0 and C#, and every reference on how to do this online, is either in a different language and just seems to be a list of names of functions, or only has examples of formatting text in a textview while generating the text from code (I.e., make a sentence "Hello World." then make the hello <strong>bold</strong>. It seems that no one is talking about how to do this, and it seems like a pretty fundamental bit of functionality. </p>
  
  <p>It's perfectly easy to make some text bold, for example:</p>
  
  <pre><code>protected void Command_bold(object sender, EventArgs e)
  {
      if (selectedTextView.Buffer.GetSelectionBounds(out A, out B))
      {
          selectedTextView.Buffer.ApplyTag("bold", A, B);
      }
  }
  </code></pre>
  
  <p>But, when I trigger this function with a button, it only makes things bold (or italics... etc). Normal functionality of a bold button would make all of the selection bold if some or none of the selection is already bold, or make it all not bold if all of it is bold. </p>
  
  <p>So, how do you detect in a Gtk TextView object, if your text is bold already or not?</p>