|
From: CVS C. to T. <the...@li...> - 2011-06-02 22:31:08
|
Revision: 651
http://themis.svn.sourceforge.net/themis/?rev=651&view=rev
Author: mark_hellegers
Date: 2011-06-02 22:31:02 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
- Code cleanup
- Moved public variables to private and adapted code
Modified Paths:
--------------
trunk/themis/framework/ThemisUrlPopUpView.cpp
trunk/themis/framework/ThemisUrlPopUpView.h
trunk/themis/framework/ThemisUrlPopUpWindow.cpp
trunk/themis/framework/ThemisUrlPopUpWindow.h
trunk/themis/framework/win.cpp
Modified: trunk/themis/framework/ThemisUrlPopUpView.cpp
===================================================================
--- trunk/themis/framework/ThemisUrlPopUpView.cpp 2011-06-02 18:11:12 UTC (rev 650)
+++ trunk/themis/framework/ThemisUrlPopUpView.cpp 2011-06-02 22:31:02 UTC (rev 651)
@@ -8,24 +8,26 @@
#include "../common/commondefs.h"
#include "ThemisUrlPopUpView.h"
-ThemisUrlPopUpView::ThemisUrlPopUpView(
- BRect frame )
- : BView(
- frame,
- "THEMISURLPOPUPVIEW",
- B_FOLLOW_ALL,
- B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE )
-{
+ThemisUrlPopUpView :: ThemisUrlPopUpView(BRect frame)
+ : BView(frame,
+ "THEMISURLPOPUPVIEW",
+ B_FOLLOW_ALL,
+ B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) {
+
BRect rect = Bounds();
- ulv = new ThemisUrlListView(
- BRect(
- rect.left + 19,
- rect.top + 1,
- rect.right - 1,
- rect.bottom - 1 ) );
- AddChild( ulv );
- ulv->AddFilter( new ThemisUrlPopUpViewMessageFilter( Window() ) );
+ ulv = new BListView(
+ BRect(rect.left + 19,
+ rect.top + 1,
+ rect.right - 1,
+ rect.bottom - 1),
+ "THEMISURLLISTVIEW",
+ B_SINGLE_SELECTION_LIST,
+ B_FOLLOW_ALL,
+ B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
+ ulv->SetFontSize(10.0);
+ AddChild(ulv);
+ ulv->AddFilter(new ThemisUrlPopUpViewMessageFilter(Window()));
}
void
@@ -50,55 +52,34 @@
}
/////////////////////////////////////
-// ThemisUrlListView
-/////////////////////////////////////
-
-ThemisUrlListView::ThemisUrlListView(
- BRect frame )
- : BListView(
- frame,
- "THEMISURLLISTVIEW",
- B_SINGLE_SELECTION_LIST,
- B_FOLLOW_ALL,
- B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE )
-{
- SetFontSize( 10.0 );
-}
-
-/////////////////////////////////////
// ThemisUrlPopUpViewMessageFilter
/////////////////////////////////////
-ThemisUrlPopUpViewMessageFilter::ThemisUrlPopUpViewMessageFilter( BWindow* win )
- : BMessageFilter( B_ANY_DELIVERY, B_ANY_SOURCE )
-{
- window = win;
+ThemisUrlPopUpViewMessageFilter :: ThemisUrlPopUpViewMessageFilter(BWindow* win)
+ : BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE) {
lastbutton = 0;
}
-filter_result
-ThemisUrlPopUpViewMessageFilter::Filter( BMessage *msg, BHandler **target )
-{
- filter_result result( B_DISPATCH_MESSAGE );
+filter_result ThemisUrlPopUpViewMessageFilter :: Filter(BMessage * msg,
+ BHandler ** target) {
+
+ filter_result result(B_DISPATCH_MESSAGE);
- switch( msg->what )
- {
- case B_MOUSE_DOWN :
- {
+ switch(msg->what) {
+ case B_MOUSE_DOWN: {
int32 buttons, clicks;
- buttons = msg->FindInt32( "buttons" );
- clicks = msg->FindInt32( "clicks" );
+ buttons = msg->FindInt32("buttons");
+ clicks = msg->FindInt32("clicks");
- BMessage* selectmsg = new BMessage( URL_SELECT_MOUSE );
+ BMessage* selectmsg = new BMessage(URL_SELECT_MOUSE);
- if( buttons == lastbutton && clicks > 1 )
- {
- selectmsg->AddBool( "doubleclick", true );
+ if (buttons == lastbutton && clicks > 1) {
+ selectmsg->AddBool("doubleclick", true);
}
lastbutton = buttons;
- BMessenger msgr( (*target) );
- msgr.SendMessage( selectmsg );
+ BMessenger msgr((*target));
+ msgr.SendMessage(selectmsg);
delete selectmsg;
@@ -109,5 +90,6 @@
default :
break;
}
+
return result;
}
Modified: trunk/themis/framework/ThemisUrlPopUpView.h
===================================================================
--- trunk/themis/framework/ThemisUrlPopUpView.h 2011-06-02 18:11:12 UTC (rev 650)
+++ trunk/themis/framework/ThemisUrlPopUpView.h 2011-06-02 22:31:02 UTC (rev 651)
@@ -15,52 +15,35 @@
class ThemisUrlListView;
-class ThemisUrlPopUpView : public BView
-{
+class ThemisUrlPopUpView : public BView {
+
public:
- ThemisUrlPopUpView(
- BRect frame );
-
- virtual void Draw( BRect updaterect );
+ ThemisUrlPopUpView(BRect frame);
+
+ virtual void Draw(BRect updaterect);
+ BListView * ulv;
- ThemisUrlListView* ulv;
};
#endif
/////////////////////////////////////
-// ThemisUrlListView
-/////////////////////////////////////
-// its just in here for later customization
-// i did nothing special in here afair :))
-
-#ifndef THEMISURLLISTVIEW
-#define THEMISURLLISTVIEW
-
-class ThemisUrlListView : public BListView
-{
- public:
- ThemisUrlListView(
- BRect frame );
-};
-
-#endif
-
-/////////////////////////////////////
// ThemisUrlPopUpViewMessageFilter
/////////////////////////////////////
#ifndef THEMISURLPOPUPVIEWMESSAGEFILTER
#define THEMISURLPOPUPVIEWMESSAGEFILTER
-class ThemisUrlPopUpViewMessageFilter : public BMessageFilter
-{
+class ThemisUrlPopUpViewMessageFilter : public BMessageFilter {
+
+ private:
+ int32 lastbutton;
+
public:
- ThemisUrlPopUpViewMessageFilter( BWindow* win );
- virtual filter_result Filter( BMessage *msg, BHandler **target );
+ ThemisUrlPopUpViewMessageFilter(BWindow* win);
+
+ virtual filter_result Filter(BMessage *msg, BHandler **target);
- BWindow* window;
- int32 lastbutton;
};
#endif
Modified: trunk/themis/framework/ThemisUrlPopUpWindow.cpp
===================================================================
--- trunk/themis/framework/ThemisUrlPopUpWindow.cpp 2011-06-02 18:11:12 UTC (rev 650)
+++ trunk/themis/framework/ThemisUrlPopUpWindow.cpp 2011-06-02 22:31:02 UTC (rev 651)
@@ -134,6 +134,13 @@
Unlock();
break;
}
+ case B_MOUSE_WHEEL_CHANGED: {
+ float value = msg->FindFloat( "be:wheel_delta_y");
+ value *= 10;
+ urlpopupview->ulv->ScrollBy(0, value);
+
+ break;
+ }
default :
BWindow::MessageReceived( msg );
}
Modified: trunk/themis/framework/ThemisUrlPopUpWindow.h
===================================================================
--- trunk/themis/framework/ThemisUrlPopUpWindow.h 2011-06-02 18:11:12 UTC (rev 650)
+++ trunk/themis/framework/ThemisUrlPopUpWindow.h 2011-06-02 22:31:02 UTC (rev 651)
@@ -22,6 +22,7 @@
BList * url_list;
BList * trunc_list;
BScrollBar * vscroll;
+ ThemisUrlPopUpView * urlpopupview;
public:
ThemisUrlPopUpWindow(BWindow* aParent, BRect aFrame, BList * aList);
@@ -33,7 +34,6 @@
void TruncateUrlStrings();
bool HasScrollBar() const;
- ThemisUrlPopUpView * urlpopupview;
};
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-06-02 18:11:12 UTC (rev 650)
+++ trunk/themis/framework/win.cpp 2011-06-02 22:31:02 UTC (rev 651)
@@ -218,16 +218,10 @@
// never get the mouse wheel messages
if (urlpopupwindow != NULL) {
if (urlpopupwindow->HasScrollBar()) {
- float value = msg->FindFloat( "be:wheel_delta_y");
- value *= 10;
-
- urlpopupwindow->Lock();
- urlpopupwindow->urlpopupview->ulv->ScrollBy(0, value);
- urlpopupwindow->Unlock();
+ BMessenger* msgr = new BMessenger(NULL, urlpopupwindow, NULL);
+ msgr->SendMessage(msg);
}
}
- // i dunno where the scroll-recognition of the rendered site shall
- // happen.. if here, then it should go into here later :D
break;
}
case BUTTON_BACK: {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|