include/GUI/components/ErrorLogComponent.hpp

Go to the documentation of this file.
00001 /*
00002   ==============================================================================
00003 
00004   This is an automatically generated file created by the Jucer!
00005 
00006   Creation date:  23 Aug 2007 2:01:39 pm
00007 
00008   Be careful when adding custom code to these files, as only the code within
00009   the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
00010   and re-saved.
00011 
00012   ------------------------------------------------------------------------------
00013 
00014   The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
00015   Copyright 2004-6 by Raw Material Software ltd.
00016 
00017   ==============================================================================
00018 */
00019 
00020 #ifndef __JUCER_HEADER_ERRORLOGCOMPONENT_ERRORLOGCOMPONENT_3D4FCE4B__
00021 #define __JUCER_HEADER_ERRORLOGCOMPONENT_ERRORLOGCOMPONENT_3D4FCE4B__
00022 
00023 //[Headers]     -- You can add your own extra header files here --
00024 #include "../UZIBase.hpp"
00025 // We need HTML parser too
00026 #include "../../HTMLParser/Parser.hpp"
00027 //[/Headers]
00028 
00029 
00030 namespace juce
00031 {
00032 
00033     struct HTMLErrorModel : public ListBoxModel
00034     {
00035         // ListBoxModel Interface
00036     public:
00037         virtual void paintListBoxItem (int rowNumber, Graphics &g, int width, int height, bool rowIsSelected)
00038         {
00039             if (rowIsSelected) 
00040             {
00041                 Colour oldClr = g.getCurrentColour();
00042                 g.setColour(Colours::grey);
00043                 g.fillRect(Rectangle(width, height));
00044                 g.setColour(oldClr);
00045             }
00046             if (!parser) { g.drawText("No HTML document parsed", 0, 0, width, (int)g.getCurrentFont().getHeight(), Justification::centred, true); }
00047             else
00048             {
00049                 // Go to the error
00050                 const HTML::Parser::ParsingError * currentError = &parser->getLastParsingError();
00051                 for (int i = 1; i < rowNumber && currentError; i++)
00052                     currentError = currentError->nextError;
00053 
00054                 // Check the error
00055                 String errorText = currentError->isError() ? "[ Error ] " : (currentError->isWarning() ? "[Warning] " : "");
00056                 errorText += currentError->getErrorString();
00057                 errorText<< " (Position : " << currentError->errorPosition << " / Length : " << currentError->errorLength << ")";
00058 
00059                 g.drawText(errorText, 0, 0, width, (int)g.getCurrentFont().getHeight(), Justification::centred, true);
00060             }
00061         }
00062         virtual int     getNumRows () { return parser ? parser->getLastParsingError().chainedErrorCount() : 0;}
00063     
00064         // Construction / Destruction
00065     public:
00066         HTMLErrorModel(HTML::Parser * _parser) : parser(_parser) {} 
00067 
00068     protected:
00070         HTML::Parser * parser;
00071 
00072     };
00073 
00074     //==============================================================================
00082     class ErrorLogComponent  : public Component, public HTMLErrorModel
00083     {
00084     public:
00085         //==============================================================================
00086         ErrorLogComponent (HTML::Parser * parser, const String & communicationError);
00087         ~ErrorLogComponent();
00088 
00089         //==============================================================================
00090         //[UserMethods]     -- You can add your own custom methods in this section.
00091         virtual void    listBoxItemClicked (int row, const MouseEvent &e);
00092         //[/UserMethods]
00093 
00094         void paint (Graphics& g);
00095         void resized();
00096 
00097 
00098         //==============================================================================
00099         juce_UseDebuggingNewOperator
00100 
00101     private:
00102         //[UserVariables]   -- You can add your own custom variables in this section.
00103         //[/UserVariables]
00104 
00105         //==============================================================================
00106         TextEditor* HTTPHeaderLog;
00107         Label* Headerlabel;
00108         ListBox* HTMLParsingList;
00109 
00110         Label* HTMLPE;
00111         TextEditor* textEditor;
00112         Label* Details;
00113 
00114         //==============================================================================
00115         // (prevent copy constructor and operator= being generated..)
00116         ErrorLogComponent (const ErrorLogComponent&);
00117         const ErrorLogComponent& operator= (const ErrorLogComponent&);
00118     };
00119 
00120 }
00121 
00122 
00123 #endif   // __JUCER_HEADER_ERRORLOGCOMPONENT_ERRORLOGCOMPONENT_3D4FCE4B__

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is