Making a fancy looking window with messages stack - c++

I try to make fancy looking messages viewer, where messages divided by formatting, other background of smth. similar. They need to looks like this - http://pastebin.com/GU1Lq087. What I found in wxWidgets to solve this problem, and why I can't use it:
wxHtmlWindow
Supports minimal HTML (a few tags). But big problem with this - html representation doesnt fill parent window. So element with width=100% will have 100% width only on standard window size. And even p tag doesnt have word wrapping (long long paragraph goes in one line with vertical scroolbar).
wxWebWiew
I need to have the ability to set generated HTML to it, but IE must to load some page first and I can rely only on IE background. It has some time to load page, even if I set HTML-string.
wxRichText
Most suitable for me. But I can't draw line like HTML's hr, or change background for the entire message block (to distinguish it from common background)
I need to show messages like this. But i didn't know how and which tool is better.

One way of achieving this would be using wxWebView with WebKit backend but I am afraid that Windows can only use IE's engine. However, there is project which allows you to use Gecko engine. I use WebKit for rendering chat in my application and it works really good (although I am using Qt). (http://www.kirix.com/labs/wxwebconnect.html)
You can always do it regular way - just create separate widget (I think it is called "frame" in wxWidgets) for single message. This way you get almost infinite possibilities. E.g. you can make "AbstractMessage" with virtual methods and then things like "AdministratorMessage", "MOTD" etc. will be a breeze.

wxRichText Most suitable for me. But I can't draw line like HTML's hr
Really? Have you looked at the docs?
( http://docs.wxwidgets.org/trunk/overview_richtextctrl.html )
Here's a couple simple ideas:
a. Write a line of blanks, underlined.
http://docs.wxwidgets.org/trunk/classwx_rich_text_ctrl.html#a333b2e675617ed2299cf91e7c0dbd0d8
b. Create an image of a horizontal line, display it using WriteImage
http://docs.wxwidgets.org/trunk/classwx_rich_text_ctrl.html#a1315611c0741d03e852ee26eba3a9d94

The funny thing is that what you want can be done using any of the 3 controls you mention. With wxHtmlWindow you just need to set its size correctly, with wxWebView I don't understand what your problem with it is at all and with wxRichTextCtrl you could just use separate controls for the areas with different backgrounds (you could almost certainly use a single control with different styles but using several controls seems simpler).

Related

QPdfDocument/QPdfView: How to display an animated PDF?

I implemented a PDF Viewing widget in C++ using Qt, loosely based on https://doc.qt.io/qt-5/qtpdf-pdfviewer-example.html, using the pdfwidgets module. (For this question, we can assume that I copied the code in that link 1:1).
This works well so far.
But now the thing is, the PDF I want to display happens to be an animated PDF. Opened in a regular viewer like Acrobat, it will show a short sequence. That sequence is located on a single page, the frames are not different slides.
In the documentation of the QPdfDocument and the QPdfPageNavigation classes, I can't find any functionality that deals with animated pages. It would suffice if I had any way to set the current animation phase.
Is this possible at all? If so, how?
It's not implemented at the moment. On Windows, you could use an ActiveQt widget to embed Acrobat Reader inside your application, if present. Otherwise you'd need to find a PDF rendering library - most likely a commercial one - that has such support.

How to draw connections between items in a QTreeView

I wonder how to draw the lines connecting the items in a QTreeView as illustrated in the picture under Tree Model. My program will run on different platforms and thus use different styles. Can I guarantee that the items are drawn as desired?
I feel, using style sheets might be problematic because certain styles do not print such lines and using a delagate might lead me into issues of double drawing.
There's an example in the documentation here showing exactly what you want to achieve using style sheets.
Please note that when you use style sheets QStyleSheetStyle kicks in, irregardless from the QStyle your application is using at the moment. So if you decide to go this way you will override the look and feel of your control the same way, irregardless from the target platform.
If that is a problem, you may consider to use style sheets only for certain platforms. As an example:
#ifdef Q_OS_MAC
myControl->setStyleSheet(":/my_stylesheet_for_mac.qss");
#endif
Back to the example in the documentation, it uses a few images containing all the various lines (vertical, horizontal, branch, etc) and the ::branch subcontrol and its states to determine which image to use.
The result is something like this:
.
Obviously, you must change the code to show the vline picture instead of the arrows.
As a side node, I may suggest to consider why you want to do this if you are using native styles. If your application has a native look and feel, you should not alter it in any way. That is, if the target platform doesn't render lines to connect tree view items, then you shouldn't add those.
However, if your application is not required to look native across all the target platforms, you may consider using the same style (e.g. Fusion) and deliver the same user experience no matter what the platform is.

wxWidgets splitted windows

I'm trying to create structure to draw many graphs in separate sub windows one below another, something that looks like that :
I need to change the size of these graph by dragging lines separating them.
I tried using panes in wxAUI but resizing one affects other, and it seems to be rather unstable. The main problem is that when I'm moving one sash to another it starts pushing it. Maybe there is some way to solve it?
I also tried using multiple wxSplitterWindow each nested in another, but this strategy also seems to fail because resizing one window affects all nested inside and their splitters are moving due to sizing even if I try to cach event EVT_SPLITTER_SASH_POS_CHANGED.
Do you have any ideas how to solve that?
I'm afraid there is indeed no out of the box solution doing what you need. wxSplitterWindow itself is implemented using wxWidgets API, so you could adapt its code to create your own window supporting multiple splitters, AFAICS it should be quite straightforward but, still, will require some work.

Window like control in SketchFlow?

I've been playing around with SketchFlow from Microsoft and one thing that bothers me is that I cannot seem to find a window looking like sketch.
I would like it to have title bar and 3 "buttons" like all normal windows do (minimize, maximize, close buttons).
In Balsamiq Mockups this is very easy, however I don't see any kind of window-like sketches in SketchFlow.
I'm trying to mockup future desktop application.
You are correct that there isn't one built in. In SketchFlow you can easily make "component" screens that can be used multiple times. To create what you are looking for you could combine a sketch rectangle, with a couple of buttons and a textbox. You can select all of this content, right click it and make it into a component screen.
The MockupsLibrary also provides the mockups you are looking for. Once you've installed it, it'll appear in your assets as "ButtonWithIconMockup". You can select the "WindowMinimize", "WindowMaximize", and "WindowClose" for your IconImage attribute to get the desired result.
With Expression Blend 4, you can install the Mockup Controls by following the instructions at How to add mockup controls to your Expression Blend library. In the new Assets | Mockups category you will see a WindowMockup item that does exactly what you wanted.
To play around with the Mockup Controls, try the MockupDemonstration sample from the Help Welcome screen.
Unfortunately, there doesn't seem to be a builtin MenuStrip yet (although you can laboriously build one yourself from the non-sketchy SimpleMenu and SimpleMenuItem controls)? Also there doesn't seem to be any support for indicating keyboard accelerators (prefixing the desired letter with & doesn't work).
In general, it seems like Sketchflow really isn't designed to be used to prototype standard desktop applications?

Squigglly line under a word (Win32)

I want to implement basic spell checking in a Notepad clone project I'm doing. I want to underline misspelled words with a squiggly like like Word does. I think I need to use GDI and draw on the text field, but I'm not sure how to draw on controls.
Thanks
If you're basing your editor on an edit control (as Notepad does), then I think it's going to be difficult. By subclassing the edit control window, you could probably augment its WM_PAINT handling. But the problem is the control doesn't expose a way for you to find out exactly where a word appears within the control. Thus you won't know where to draw the squiggle.
You might be able to use a Rich Edit control (as WordPad does) and tweak the styling of the misspelled words. I've never used Rich Edit, so I can't help with the details.
Actually, I'm not sure about the method which you're using to render text in your window and I think you need to concretize it.
If everything is done using winapi/gdi (generally speaking, this would be TextOuting the current text block, that fits the window considering wrapping, etc...), you should add another routine, that would handle misspelled words rendering.
Again, this also depends on your way to save current text and it's parameters, but the idea is to implement some sort of function like RenderMisspelledWord(...), which would take your generic text-handling class or some kind of renderer class or even (X, Y, Length) as params. This function would be called from a more general Render method, which would be called from WM_PAINT handler.
What it would do also depends on your notepad architecture, but, for example, in last case that would require drawing * /\ /\ /\ * parts of your underlining using GDI (line) routines.
Generally speaking, every other case (with handling classes) would lead to the following action too, but with higher level of abstraction.